29 lines
1.2 KiB
Plaintext
29 lines
1.2 KiB
Plaintext
// Wraps a given generic KeyShortcutHandler within
|
|
// the FlxKeyShortcutHandler that every SimpleWindow has,
|
|
// using the window to display available mappings
|
|
// from the currently active prefix map
|
|
(defNew [&prop :KeyShortcutHandler<T> innerKeyShortcuts
|
|
&prop :T->String elementToStringWithoutBrackets
|
|
&opt :String title
|
|
:FlxColor bgColor
|
|
:FlxColor textColor
|
|
:Float percentWidth
|
|
:Float percentHeight]
|
|
(super title bgColor textColor percentWidth percentHeight)
|
|
(set innerKeyShortcuts.onSelectPrefixMap ->map {
|
|
(clearControls)
|
|
(doFor =>key keyBehavior map
|
|
(case keyBehavior
|
|
((Final item)
|
|
(makeText "[${key}] - $(elementToString item)" null ->_ (innerKeyShortcuts.onSelectItem item)))
|
|
((Prefix innerMap)
|
|
(makeText "[${key}] - $(count innerMap) more options" null ->_ (innerKeyShortcuts.onSelectPrefixMap innerMap)))
|
|
(null null)))}))
|
|
|
|
(method &override :Void show []
|
|
(super.show)
|
|
(innerKeyShortcuts.start))
|
|
|
|
(method &override :Void hide []
|
|
(super.hide)
|
|
(innerKeyShortcuts.cancel)) |