new GOWN.ToggleButton()
Basic button that has a selected state which indicates if the button
is pressed or not.
Extends
Members
-
static,readonlyGOWN.ToggleButton.CHANGEString
-
Dispatched when the button is selected or deselected either programmatically or as a result of user interaction.The value of the
selected
property indicates whether the button is selected. or not. -
static,readonlyGOWN.ToggleButton.SELECTED_DOWNString
-
Selected down state: mouse button is pressed or finger touches the screen + the toggle button is selected
-
static,readonlyGOWN.ToggleButton.SELECTED_HOVERString
-
Selected hover state: mouse pointer hovers over the button + the toggle button is selected (ignored on mobile)
-
static,readonlyGOWN.ToggleButton.SELECTED_UPString
-
Selected up state: mouse button is released or finger is removed from the screen + the toggle button is selected
-
static,readonlyGOWN.ToggleButton.SKIN_NAMEString
-
Default toggle button skin name
-
allowDestroyCachebool
-
Will destroy the skin cache when the skinable gets destroyed
- Default Value:
- true
-
currentStateString
-
The current state
-
enabledBoolean
-
Enables/Disables the control. (not implemented yet)
-
labelString
-
Create/Update the label of the button.
-
selectedBoolean
-
Indicate if the button is selected (pressed)
- Default Value:
- false
-
skinFallbackString
-
The fallback skin if the other skin does not exist (e.g. if a mobile theme that does not provide a "hover" state is used on a desktop system)
-
skinNameString
-
The skin name
- Default Value:
- Button.SKIN_NAME
Methods
-
inherited changeSkin(skin)
-
Remove old skin and add new one
Name Type Description skin
DisplayObject -
inherited destroy()
-
Destroy the Skinable and empty the skin cache
-
inherited fromSkin(name, callback)
-
Get image from skin (will execute a callback with the loaded skin when it is loaded or call it directly when it already is loaded)
Name Type Description name
String name of the state callback
function callback that is executed if the skin is loaded -
protectedhandleEvent(type)
-
handle the touch/tap event
Name Type Description type
Object the type of the press/touch. -
inherited mousePos(){PIXI.Point}
-
Get the local mouse position from PIXI.InteractionData
Returns:
Type Description PIXI.Point -
inherited protectedonDown()
-
onDown callback
-
inherited protectedonHover()
-
onHover callback
-
inherited protectedonOut()
-
onOut callback
-
inherited protectedonTouchMove()
-
onTouchMove callback
-
inherited protectedonUp()
-
onUp callback
-
inherited protectedpreloadSkins()
-
Initiate all skins first (to prevent flickering)
-
inherited protectedredraw()
-
Update before draw call (position label)
-
inherited setTheme(theme)
-
Change the theme
Name Type Description theme
GOWN.Theme the new theme -
inherited protectedskinLoaded(skin)
-
Skin has been loaded (see preloadSkins) and stored into the skinCache. add to container, hide and resize
Name Type Description skin
the loaded skin -
toggle()
-
Toggle the state
-
inherited protectedupdateDimensions()
-
Update width/height of the button
-
inherited updateTheme(data)
-
Overwrite data from theme for this specific component. (usable if you want to change e.g. background color based on selected items)
Name Type Description data
updated skin data