SimpleWindow.promptForChoice
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
(prop &mut keyboardEnabled true)
|
||||
|
||||
// TODO tooltip support with left-click and right-click action
|
||||
// icons and explanations
|
||||
// icons and explanations?
|
||||
|
||||
(defNew [&opt :String _title
|
||||
:FlxColor bgColor
|
||||
@@ -129,4 +129,23 @@
|
||||
}
|
||||
{
|
||||
(set text.color color)
|
||||
})))))))
|
||||
})))))))
|
||||
|
||||
(function :SimpleWindow promptForChoice <>[T] [:String prompt
|
||||
:Array<T> choices
|
||||
:T->Void onChoice
|
||||
&opt :FlxColor bgColor
|
||||
:FlxColor titleColor
|
||||
:FlxColor choiceColor
|
||||
:Float percentWidth
|
||||
:Float percentHeight]
|
||||
(let [window (new SimpleWindow prompt bgColor titleColor percentWidth percentHeight)
|
||||
choiceColor (or choiceColor titleColor FlxColor.WHITE)]
|
||||
(doFor choice choices
|
||||
(window.makeText (Std.string choice) choiceColor
|
||||
->:Void s {
|
||||
(window.hide)
|
||||
(onChoice choice)
|
||||
}))
|
||||
(window.show)
|
||||
window))
|
Reference in New Issue
Block a user