Skip to content

Commit

Permalink
ButtonMultiSkin, ToggleButtonMultiSkin, TextInputMultiSkin
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed Jun 3, 2024
1 parent 72e2d14 commit 14184b1
Show file tree
Hide file tree
Showing 3 changed files with 297 additions and 0 deletions.
77 changes: 77 additions & 0 deletions src/feathers/skins/ButtonMultiSkin.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
Feathers UI
Copyright 2024 Bowler Hat LLC. All Rights Reserved.
This program is free software. You can redistribute and/or modify it in
accordance with the terms of the accompanying license agreement.
*/

package feathers.skins;

import feathers.controls.ButtonState;
import openfl.display.DisplayObject;

/**
A variation of `MultiSkin` that declares fields for the states defined in
`feathers.controls.ButtonState`.
@see `feathers.controls.Button`
**/
class ButtonMultiSkin extends MultiSkin {
/**
Creates a new `ButtonMultiSkin` object.
@since 1.3.0
**/
public function new(defaultView:DisplayObject) {
super(defaultView);
}

/**
The view for `feathers.controls.ButtonState.UP`.
@since 1.3.0
**/
public var upView(get, set):DisplayObject;

private function get_upView():DisplayObject {
return this.getViewForState(ButtonState.UP);
}

private function set_upView(value:DisplayObject):DisplayObject {
this.setViewForState(ButtonState.UP, value);
return value;
}

/**
The view for `feathers.controls.ButtonState.HOVER`.
@since 1.3.0
**/
public var hoverView(get, set):DisplayObject;

private function get_hoverView():DisplayObject {
return this.getViewForState(ButtonState.HOVER);
}

private function set_hoverView(value:DisplayObject):DisplayObject {
this.setViewForState(ButtonState.HOVER, value);
return value;
}

/**
The view for `feathers.controls.ButtonState.DOWN`.
@since 1.3.0
**/
public var downView(get, set):DisplayObject;

private function get_downView():DisplayObject {
return this.getViewForState(ButtonState.DOWN);
}

private function set_downView(value:DisplayObject):DisplayObject {
this.setViewForState(ButtonState.DOWN, value);
return value;
}
}
78 changes: 78 additions & 0 deletions src/feathers/skins/TextInputMultiSkin.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
Feathers UI
Copyright 2024 Bowler Hat LLC. All Rights Reserved.
This program is free software. You can redistribute and/or modify it in
accordance with the terms of the accompanying license agreement.
*/

package feathers.skins;

import feathers.controls.TextInputState;
import openfl.display.DisplayObject;

/**
A variation of `MultiSkin` that declares fields for the states defined in
`feathers.controls.TextInputState`.
@see `feathers.controls.TextArea`
@see `feathers.controls.TextInput`
**/
class TextInputMultiSkin extends MultiSkin {
/**
Creates a new `TextInputMultiSkin` object.
@since 1.3.0
**/
public function new(defaultView:DisplayObject) {
super(defaultView);
}

/**
The view for `feathers.controls.TextInputState.ENABLED`.
@since 1.3.0
**/
public var enabledView(get, set):DisplayObject;

private function get_enabledView():DisplayObject {
return this.getViewForState(TextInputState.ENABLED);
}

private function set_enabledView(value:DisplayObject):DisplayObject {
this.setViewForState(TextInputState.ENABLED, value);
return value;
}

/**
The view for `feathers.controls.TextInputState.FOCUSED`.
@since 1.3.0
**/
public var focusedView(get, set):DisplayObject;

private function get_focusedView():DisplayObject {
return this.getViewForState(TextInputState.FOCUSED);
}

private function set_focusedView(value:DisplayObject):DisplayObject {
this.setViewForState(TextInputState.FOCUSED, value);
return value;
}

/**
The view for `feathers.controls.TextInputState.ERROR`.
@since 1.3.0
**/
public var errorView(get, set):DisplayObject;

private function get_errorView():DisplayObject {
return this.getViewForState(TextInputState.ERROR);
}

private function set_errorView(value:DisplayObject):DisplayObject {
this.setViewForState(TextInputState.ERROR, value);
return value;
}
}
142 changes: 142 additions & 0 deletions src/feathers/skins/ToggleButtonMultiSkin.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/*
Feathers UI
Copyright 2024 Bowler Hat LLC. All Rights Reserved.
This program is free software. You can redistribute and/or modify it in
accordance with the terms of the accompanying license agreement.
*/

package feathers.skins;

import feathers.controls.ToggleButtonState;
import openfl.display.DisplayObject;

/**
A variation of `MultiSkin` that declares fields for the states defined in
`feathers.controls.ToggleButtonState`.
@see `feathers.controls.ToggleButton`
@see `feathers.controls.ItemRenderer`
**/
class ToggleButtonMultiSkin extends MultiSkin {
/**
Creates a new `ToggleButtonMultiSkin` object.
@since 1.3.0
**/
public function new(defaultView:DisplayObject) {
super(defaultView);
}

/**
The view for `feathers.controls.ToggleButtonState.UP(false)`.
@since 1.3.0
**/
public var upView(get, set):DisplayObject;

private function get_upView():DisplayObject {
return this.getViewForState(ToggleButtonState.UP(false));
}

private function set_upView(value:DisplayObject):DisplayObject {
this.setViewForState(ToggleButtonState.UP(false), value);
return value;
}

/**
The view for `feathers.controls.ToggleButtonState.HOVER(false)`.
@since 1.3.0
**/
public var hoverView(get, set):DisplayObject;

private function get_hoverView():DisplayObject {
return this.getViewForState(ToggleButtonState.HOVER(false));
}

private function set_hoverView(value:DisplayObject):DisplayObject {
this.setViewForState(ToggleButtonState.HOVER(false), value);
return value;
}

/**
The view for `feathers.controls.ToggleButtonState.DOWN(false)`.
@since 1.3.0
**/
public var downView(get, set):DisplayObject;

private function get_downView():DisplayObject {
return this.getViewForState(ToggleButtonState.DOWN(false));
}

private function set_downView(value:DisplayObject):DisplayObject {
this.setViewForState(ToggleButtonState.DOWN(false), value);
return value;
}

/**
The view for `feathers.controls.ToggleButtonState.UP(true)`.
@since 1.3.0
**/
public var selectedUpView(get, set):DisplayObject;

private function get_selectedUpView():DisplayObject {
return this.getViewForState(ToggleButtonState.UP(true));
}

private function set_selectedUpView(value:DisplayObject):DisplayObject {
this.setViewForState(ToggleButtonState.UP(true), value);
return value;
}

/**
The view for `feathers.controls.ToggleButtonState.HOVER(true)`.
@since 1.3.0
**/
public var selectedHoverView(get, set):DisplayObject;

private function get_selectedHoverView():DisplayObject {
return this.getViewForState(ToggleButtonState.HOVER(true));
}

private function set_selectedHoverView(value:DisplayObject):DisplayObject {
this.setViewForState(ToggleButtonState.HOVER(true), value);
return value;
}

/**
The view for `feathers.controls.ToggleButtonState.DOWN(true)`.
@since 1.3.0
**/
public var selectedDownView(get, set):DisplayObject;

private function get_selectedDownView():DisplayObject {
return this.getViewForState(ToggleButtonState.DOWN(true));
}

private function set_selectedDownView(value:DisplayObject):DisplayObject {
this.setViewForState(ToggleButtonState.DOWN(true), value);
return value;
}

/**
The view for `feathers.controls.ToggleButtonState.DISABLED(true)`.
@since 1.3.0
**/
public var selectedDisabledView(get, set):DisplayObject;

private function get_selectedDisabledView():DisplayObject {
return this.getViewForState(ToggleButtonState.DISABLED(true));
}

private function set_selectedDisabledView(value:DisplayObject):DisplayObject {
this.setViewForState(ToggleButtonState.DISABLED(true), value);
return value;
}
}

0 comments on commit 14184b1

Please sign in to comment.