SimpleWindow allow events/tooltip stuff on non-text control
This commit is contained in:
@@ -327,7 +327,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 +362,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 +610,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])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user