UI to delete habits

This commit is contained in:
2022-08-29 21:03:22 +00:00
parent fba58b28fd
commit cfff1d689d

View File

@@ -51,7 +51,7 @@
(prop :Map<FlxSprite,Action> _actions (new Map)) (prop :Map<FlxSprite,Action> _actions (new Map))
(prop :Map<FlxSprite,FlxColor> _colors (new Map)) (prop :Map<FlxSprite,FlxColor> _colors (new Map))
(method makeText [:String text &opt :FlxColor color :Action onClick] (method makeText [:String text &opt :FlxColor color :Action onClick :Bool noShortcut]
(let [ftext (new FlxText nextControlX nextControlY 0 text textSize)] (let [ftext (new FlxText nextControlX nextControlY 0 text textSize)]
(set ftext.color (or color textColor)) (set ftext.color (or color textColor))
(dictSet _colors ftext ftext.color) (dictSet _colors ftext ftext.color)
@@ -67,7 +67,8 @@
(when onClick (when onClick
(dictSet _actions ftext onClick) (dictSet _actions ftext onClick)
// TODO right click? // TODO right click?
(keyHandler.registerItem text ->:Void (onClick ftext))) (unless noShortcut
(keyHandler.registerItem text ->:Void (onClick ftext))))
ftext)) ftext))
// TODO makeButton // TODO makeButton
@@ -138,7 +139,8 @@
:FlxColor titleColor :FlxColor titleColor
:FlxColor choiceColor :FlxColor choiceColor
:Float percentWidth :Float percentWidth
:Float percentHeight] :Float percentHeight
:Bool noShortcuts]
(let [window (new SimpleWindow prompt bgColor titleColor percentWidth percentHeight) (let [window (new SimpleWindow prompt bgColor titleColor percentWidth percentHeight)
choiceColor (or choiceColor titleColor FlxColor.WHITE)] choiceColor (or choiceColor titleColor FlxColor.WHITE)]
(doFor choice choices (doFor choice choices
@@ -146,6 +148,7 @@
->:Void s { ->:Void s {
(window.hide) (window.hide)
(onChoice choice) (onChoice choice)
})) }
noShortcuts))
(window.show) (window.show)
window)) window))