44 lines
955 B
Haxe
Executable File
44 lines
955 B
Haxe
Executable File
package haxework.gui;
|
|
|
|
import flash.display.Sprite;
|
|
import haxework.gui.skin.ISkin;
|
|
|
|
class ToggleButtonView extends ButtonView {
|
|
|
|
public var on(default, set):Bool;
|
|
public var onSkin(default, set):ISkin<Sprite, IView<Sprite>>;
|
|
|
|
public var onText(default, set):String;
|
|
|
|
public function new() {
|
|
super();
|
|
}
|
|
|
|
private function set_on(value:Bool):Bool {
|
|
on = value;
|
|
invalidate();
|
|
return on;
|
|
}
|
|
|
|
private function set_onSkin(value:ISkin<Sprite, IView<Sprite>>):ISkin<Sprite, IView<Sprite>> {
|
|
onSkin = value;
|
|
invalidate();
|
|
return onSkin;
|
|
}
|
|
|
|
override private function currentSkin():ISkin<Sprite, IView<Sprite>> {
|
|
return on ? onSkin : skin;
|
|
}
|
|
|
|
private function set_onText(value:String):String {
|
|
if (onText != value) {
|
|
onText = value;
|
|
invalidate;
|
|
}
|
|
return onText;
|
|
}
|
|
|
|
override private function currentText():String {
|
|
return on && onText != null ? onText : super.currentText();
|
|
}
|
|
} |