Compare commits
2 Commits
7b81f24a7d
...
95bbeed5e8
| Author | SHA1 | Date | |
|---|---|---|---|
| 95bbeed5e8 | |||
| 1d3064b6b6 |
@@ -48,13 +48,15 @@
|
|||||||
(Std.isOfType controlToSelect KissInputText)))
|
(Std.isOfType controlToSelect KissInputText)))
|
||||||
|
|
||||||
(when controlToDeselect
|
(when controlToDeselect
|
||||||
(set controlToDeselect.color (dictGet _colors controlToDeselect))
|
(whenLet [c (dictGet _colors controlToDeselect)]
|
||||||
|
(set controlToDeselect.color c))
|
||||||
(whenLet [onDeselectLast (dictGet _onDeselectEvents controlToDeselect)]
|
(whenLet [onDeselectLast (dictGet _onDeselectEvents controlToDeselect)]
|
||||||
(onDeselectLast controlToDeselect)))
|
(onDeselectLast controlToDeselect)))
|
||||||
|
|
||||||
(set _selectedIndex value)
|
(set _selectedIndex value)
|
||||||
(when (= -1 value) (return value))
|
(when (= -1 value) (return value))
|
||||||
(set controlToSelect.color (getHighlighted (dictGet _colors controlToSelect)))
|
(whenLet [c (dictGet _colors controlToSelect)]
|
||||||
|
(set controlToSelect.color (getHighlighted c)))
|
||||||
|
|
||||||
// HANDLE WHEN A CONTROL IS SELECTED:
|
// HANDLE WHEN A CONTROL IS SELECTED:
|
||||||
{
|
{
|
||||||
@@ -327,7 +329,7 @@
|
|||||||
(set beforeHorizX nextControlX))
|
(set beforeHorizX nextControlX))
|
||||||
(set horiz !horiz))
|
(set horiz !horiz))
|
||||||
|
|
||||||
(method addControl [:FlxSprite control &opt :Bool ignoreLayout]
|
(method addControl [:FlxSprite control &opt :Bool ignoreLayout :Action onClick :Action onSelect :Action onDeselect :String tooltipText :Map<String,Action> altActions]
|
||||||
(when ?ignoreLayout
|
(when ?ignoreLayout
|
||||||
(nonLayoutControls.push control))
|
(nonLayoutControls.push control))
|
||||||
|
|
||||||
@@ -362,6 +364,19 @@
|
|||||||
(columnWidths.push 0)
|
(columnWidths.push 0)
|
||||||
(when (> (apply + columnWidths) width)
|
(when (> (apply + columnWidths) width)
|
||||||
(makeScrollArrows)))))))
|
(makeScrollArrows)))))))
|
||||||
|
(when onSelect
|
||||||
|
(dictSet _onSelectEvents control onSelect))
|
||||||
|
(when onDeselect
|
||||||
|
(dictSet _onDeselectEvents control onDeselect))
|
||||||
|
(when onClick
|
||||||
|
(dictSet _actions control onClick)
|
||||||
|
|
||||||
|
(when (and selectFirstInteractiveControl (= -1 _selectedIndex))
|
||||||
|
(set selectedIndex (.indexOf (getColumnControls) control))))
|
||||||
|
(when altActions
|
||||||
|
(dictSet _altActions control altActions))
|
||||||
|
(when tooltipText
|
||||||
|
(dictSet _tooltips control tooltipText))
|
||||||
control)
|
control)
|
||||||
|
|
||||||
(prop &mut :Bool _useScrolling false)
|
(prop &mut :Bool _useScrolling false)
|
||||||
@@ -597,23 +612,12 @@
|
|||||||
(when fontPath
|
(when fontPath
|
||||||
(set t.font fontPath))
|
(set t.font fontPath))
|
||||||
t))]
|
t))]
|
||||||
|
(when onClick
|
||||||
|
(unless noShortcut
|
||||||
|
(keyHandler.registerItem text ->:Void (onClick ftext))))
|
||||||
(set ftext.color (or color textColor))
|
(set ftext.color (or color textColor))
|
||||||
(dictSet _colors ftext ftext.color)
|
(dictSet _colors ftext ftext.color)
|
||||||
(addControl ftext ?overridePosition)
|
(addControl ftext ?overridePosition onClick onSelect onDeselect tooltipText altActions)
|
||||||
(when onSelect
|
|
||||||
(dictSet _onSelectEvents ftext onSelect))
|
|
||||||
(when onDeselect
|
|
||||||
(dictSet _onDeselectEvents ftext onDeselect))
|
|
||||||
(when onClick
|
|
||||||
(dictSet _actions ftext onClick)
|
|
||||||
(unless noShortcut
|
|
||||||
(keyHandler.registerItem text ->:Void (onClick ftext)))
|
|
||||||
(when (and selectFirstInteractiveControl (= -1 _selectedIndex))
|
|
||||||
(set selectedIndex (.indexOf (getColumnControls) ftext))))
|
|
||||||
(when altActions
|
|
||||||
(dictSet _altActions ftext altActions))
|
|
||||||
(when tooltipText
|
|
||||||
(dictSet _tooltips ftext tooltipText))
|
|
||||||
ftext))
|
ftext))
|
||||||
(redefineWithObjectArgs makeText &public makeTextV2 [text])
|
(redefineWithObjectArgs makeText &public makeTextV2 [text])
|
||||||
|
|
||||||
@@ -788,10 +792,12 @@
|
|||||||
(hideTooltipText)))
|
(hideTooltipText)))
|
||||||
|
|
||||||
(set otherIsSelected true)
|
(set otherIsSelected true)
|
||||||
(set text.color (getHighlighted (dictGet _colors text)))
|
(whenLet [c (dictGet _colors text)]
|
||||||
|
(set text.color (getHighlighted c)))
|
||||||
(set selectedIndex (columnControls.indexOf text))
|
(set selectedIndex (columnControls.indexOf text))
|
||||||
}
|
}
|
||||||
(set text.color (dictGet _colors text)))))))
|
(whenLet [c (dictGet _colors text)]
|
||||||
|
(set text.color c)))))))
|
||||||
// Click on text boxes to focus them
|
// Click on text boxes to focus them
|
||||||
(inputTexts.forEach ->:Void text
|
(inputTexts.forEach ->:Void text
|
||||||
(when FlxG.mouse.justPressed
|
(when FlxG.mouse.justPressed
|
||||||
|
|||||||
Reference in New Issue
Block a user