* Translated using Weblate (English (United States)) Currently translated at 100.0% (316 of 316 strings) Translation: Playlet/Playlet Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/en_US/ * Translated using Weblate (German) Currently translated at 100.0% (316 of 316 strings) Translation: Playlet/Playlet Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/de/ * Translated using Weblate (French (Canada)) Currently translated at 98.7% (312 of 316 strings) Translation: Playlet/Playlet Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/fr_CA/ * Fix case * remove "unfinished" attribute * UI Refactor (#394) * Setting category refactor * tweak * Wip navbar * profile icon support * screen offset * Nav bar animation * Flexible navbar * initial focus fix * Fix settings * changelog * comment * Lint fix --------- Co-authored-by: Lacey Anaya <yecakeh263@anawalls.com> Co-authored-by: github-action linter <githubaction@githubaction.com>
36 lines
993 B
Plaintext
36 lines
993 B
Plaintext
import "pkg:/source/utils/MathUtils.bs"
|
|
import "pkg:/source/utils/Types.bs"
|
|
|
|
function Init()
|
|
m.top.observeField("checkedState", FuncName(OnCheckedStateChange))
|
|
m.minItemWidth = m.top.itemSize[0]
|
|
end function
|
|
|
|
function OnValueChange()
|
|
m.top.checkedState = [m.top.value]
|
|
end function
|
|
|
|
function OnCheckedStateChange() as void
|
|
checkedState = m.top.checkedState
|
|
if checkedState = invalid or checkedState.Count() = 0
|
|
return
|
|
end if
|
|
m.top.value = checkedState[0]
|
|
end function
|
|
|
|
function OnTitleChange()
|
|
title = m.top.title
|
|
|
|
' Creating a label is wasteful, but
|
|
' - Internal label of the checkbox is not accessible
|
|
' - ifFont.GetOneLineWidth is a Main/Task thread only
|
|
label = CreateObject("roSGNode", "Label")
|
|
label.font = m.top.focusedFont
|
|
label.text = title
|
|
titleWidth = label.boundingRect().width
|
|
size = titleWidth + 50
|
|
|
|
size = MathUtils.Max(size, m.minItemWidth)
|
|
m.top.itemSize = [size, m.top.itemSize[1]]
|
|
end function
|