Class GUITogglePanel
java.lang.Object
com.blackrook.gui.GUIObject
com.blackrook.gui.object.GUITogglePanel
- All Implemented Interfaces:
GUIToggleable, GUIValueField<Boolean>
- Direct Known Subclasses:
GUICheckbox, GUIRadioButton
A checkbox object that holds a boolean switch.
This object is very much undecorated. You will have to apply colors and stuff to it. Listening to its state will be useful for setting its colors and look.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested classes/interfaces inherited from class GUIObject
GUIObject.ScaleType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final GUIActionPress action.protected static final GUIActionRelease action.Fields inherited from class GUIObject
absoluteBounds, EVENT_BLUR, EVENT_CHANGE_ENABLE_STATE, EVENT_CHANGE_VISIBLE_STATE, EVENT_FOCUS, EVENT_GAMEPAD_AXIS, EVENT_GAMEPAD_PRESS, EVENT_GAMEPAD_RELEASE, EVENT_GAMEPAD_TAP_PRESS, EVENT_GAMEPAD_TAP_RELEASE, EVENT_GENERIC_INPUT, EVENT_KEY_PRESS, EVENT_KEY_RELEASE, EVENT_KEY_TYPE, EVENT_MOUSE_CLICK, EVENT_MOUSE_DRAG, EVENT_MOUSE_LEAVE, EVENT_MOUSE_MOVE, EVENT_MOUSE_OVER, EVENT_MOUSE_PRESS, EVENT_MOUSE_RELEASE, EVENT_MOUSE_WHEEL, EVENT_NAMED, EVENT_UNKNOWNFields inherited from interface GUIValueField
EVENT_VALUE_CHANGE -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new toggle panel in the unset, false state.GUITogglePanel(boolean startState) Creates a new toggle panel. -
Method Summary
Modifier and TypeMethodDescriptiongetValue()booleanbooleanisSet()Gets the state of this toggleable object.setState(boolean state) Changes the state of this toggleable object to the specified state.Sets this field's value.toggle()Changes the state of this toggleable object to the opposite state.Methods inherited from class GUIObject
addChild, addChild, addName, addToRenderSet, animate, animate, animate, animateAbort, animateDelay, animateFinish, bindAction, callAction, correctPosition, fireEvent, getAbsoluteBounds, getAsQuery, getBounds, getChildrenAsQuery, getColor, getColorNotInherited, getDescendantsAsQuery, getFinalOpacity, getGeneration, getGUI, getLayout, getLayoutAttrib, getNativeBounds, getOpacity, getParent, getParentAsQuery, getRenderAlpha, getRenderBlue, getRendered, getRenderGreen, getRenderHeight, getRenderPositionX, getRenderPositionY, getRenderRadius, getRenderRed, getRenderRotationZ, getRenderTextureScaleS, getRenderTextureScaleT, getRenderWidth, getScaleType, getSiblingsAsQuery, getTexture, getTheme, getThemeKey, getVisible, hasAction, hasName, hasNamePattern, isAnimating, isConstrainedToParent, isEnabled, isFocused, isInert, isVisible, moveDown, moveToBack, moveToFront, moveUp, onGUIChange, releaseFocus, remove, removeChild, removeName, requestFocus, resizeChildren, rotate, setBounds, setBounds, setBoundsByChildren, setColor, setColor, setColorNotInherited, setConstrainToParent, setDimensions, setEnabled, setInert, setLayout, setLayoutAttrib, setOpacity, setPosition, setRendered, setRotationZ, setScaleType, setTexture, setTheme, setVisible, stretch, toString, translate, unbindAction, unbindAllActions, updateDirty, updateScenePosition, useRenderRadius
-
Field Details
-
PRESS_ACTION
Press action. -
RELEASE_ACTION
Release action.
-
-
Constructor Details
-
GUITogglePanel
public GUITogglePanel()Creates a new toggle panel in the unset, false state. -
GUITogglePanel
public GUITogglePanel(boolean startState) Creates a new toggle panel.- Parameters:
startState- the starting state (true or false).
-
-
Method Details
-
isSet
public boolean isSet()Description copied from interface:GUIToggleableGets the state of this toggleable object.- Specified by:
isSetin interfaceGUIToggleable- Returns:
- true if this is in the enabled state, false if not.
-
toggle
Description copied from interface:GUIToggleableChanges the state of this toggleable object to the opposite state. If true, calling this sets it to false. If false, calling this sets it to true.- Specified by:
togglein interfaceGUIToggleable- Returns:
- itself, to chain calls.
-
setState
Description copied from interface:GUIToggleableChanges the state of this toggleable object to the specified state. Must fire anGUIValueField.EVENT_VALUE_CHANGEif the state of this object changes.- Specified by:
setStatein interfaceGUIToggleable- Parameters:
state- the new state.- Returns:
- itself, to chain calls.
-
getValue
- Specified by:
getValuein interfaceGUIValueField<Boolean>- Returns:
- this field's current value.
-
setValue
Description copied from interface:GUIValueFieldSets this field's value. This must accept any object, and attempt to set the correct value based on it. This object must fire anGUIValueField.EVENT_VALUE_CHANGEevent if it changes from its current value.- Specified by:
setValuein interfaceGUIValueField<Boolean>- Parameters:
value- the value to set.- Returns:
- itself, to chain calls.
-
isBeingClicked
public boolean isBeingClicked()- Returns:
- true if this object is in the middle of being clicked.
-