Compare commits
2 Commits
7b81f24a7d
...
95bbeed5e8
| Author | SHA1 | Date | |
|---|---|---|---|
| 95bbeed5e8 | |||
| 1d3064b6b6 |
@@ -48,13 +48,15 @@
|
||||
(Std.isOfType controlToSelect KissInputText)))
|
||||
|
||||
(when controlToDeselect
|
||||
(set controlToDeselect.color (dictGet _colors controlToDeselect))
|
||||
(whenLet [c (dictGet _colors controlToDeselect)]
|
||||
(set controlToDeselect.color c))
|
||||
(whenLet [onDeselectLast (dictGet _onDeselectEvents controlToDeselect)]
|
||||
(onDeselectLast controlToDeselect)))
|
||||
|
||||
(set _selectedIndex 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:
|
||||
{
|
||||
@@ -327,7 +329,7 @@
|
||||
(set beforeHorizX nextControlX))
|
||||
(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
|
||||
(nonLayoutControls.push control))
|
||||
|
||||
@@ -362,6 +364,19 @@
|
||||
(columnWidths.push 0)
|
||||
(when (> (apply + columnWidths) width)
|
||||
(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)
|
||||
|
||||
(prop &mut :Bool _useScrolling false)
|
||||
@@ -597,23 +612,12 @@
|
||||
(when fontPath
|
||||
(set t.font fontPath))
|
||||
t))]
|
||||
(when onClick
|
||||
(unless noShortcut
|
||||
(keyHandler.registerItem text ->:Void (onClick ftext))))
|
||||
(set ftext.color (or color textColor))
|
||||
(dictSet _colors ftext ftext.color)
|
||||
(addControl ftext ?overridePosition)
|
||||
(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))
|
||||
(addControl ftext ?overridePosition onClick onSelect onDeselect tooltipText altActions)
|
||||
ftext))
|
||||
(redefineWithObjectArgs makeText &public makeTextV2 [text])
|
||||
|
||||
@@ -788,10 +792,12 @@
|
||||
(hideTooltipText)))
|
||||
|
||||
(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 text.color (dictGet _colors text)))))))
|
||||
(whenLet [c (dictGet _colors text)]
|
||||
(set text.color c)))))))
|
||||
// Click on text boxes to focus them
|
||||
(inputTexts.forEach ->:Void text
|
||||
(when FlxG.mouse.justPressed
|
||||
|
||||
Reference in New Issue
Block a user