Package heronarts.glx.ui.component
Class UIToggleSet
java.lang.Object
heronarts.glx.ui.UIEventHandler
heronarts.glx.ui.UIObject
heronarts.glx.ui.UI2dComponent
heronarts.glx.ui.component.UIParameterComponent
heronarts.glx.ui.component.UIToggleSet
- All Implemented Interfaces:
UIContextActions
,UIControlTarget
,UIFocus
,UIKeyFocus
,UIMouseFocus
,UITabFocus
,LXLoopTask
,LXParameterListener
public class UIToggleSet
extends UIParameterComponent
implements UIFocus, UIControlTarget, LXParameterListener
-
Nested Class Summary
Nested classes/interfaces inherited from class heronarts.glx.ui.UI2dComponent
UI2dComponent.Scissor, UI2dComponent.Scissored, UI2dComponent.UIDragReorder
Nested classes/interfaces inherited from interface heronarts.glx.ui.UIContextActions
UIContextActions.Action
-
Field Summary
Fields inherited from class heronarts.glx.ui.component.UIParameterComponent
DEFAULT_HEIGHT, useCommandEngine
Fields inherited from class heronarts.glx.ui.UI2dComponent
debug, debugName, height, marginBottom, marginLeft, marginRight, marginTop, redraw, scissor, textAlignHorizontal, textAlignVertical, textOffsetX, textOffsetY, width, x, y
-
Constructor Summary
ConstructorDescriptionUIToggleSet
(float x, float y, float w, float h) UIToggleSet
(float x, float y, float w, float h, DiscreteParameter parameter) UIToggleSet
(float w, float h, DiscreteParameter parameter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Objects are encouraged to override this method providing a helpful String displayed to the user explaining the function of this UI component.int
Gets the index of the currently selected value in the toggle setGet the currently selected option in the toggle setvoid
Subclasses should override this method to perform their drawing functions.protected void
onKeyPressed
(KeyEvent keyEvent, char keyChar, int keyCode) Subclasses override to receive key eventsprotected void
onMousePressed
(MouseEvent mouseEvent, float mx, float my) Subclasses override to receive mouse eventsvoid
onParameterChanged
(LXParameter parameter) Invoked when the value of a parameter is changed.protected void
onResize()
Subclasses may override this method, invoked when the component is resizedprotected void
onToggle
(int value) protected void
setActiveColor
(int activeColor) setActiveColor
(UIColor activeColor) setEvenSpacing
(boolean evenSpacing) setOptions
(String[] options) setParameter
(DiscreteParameter parameter) setSelectedIndex
(int index) Sets the selected index in the toggle setsetSelectedOption
(String option) Sets the value of the control to the given value in the toggle setMethods inherited from class heronarts.glx.ui.component.UIParameterComponent
getContextActions, getOscAddress, onMouseReleased, setEnableContextActions, setModulationRangeCommand, setNormalizedCommand, setUseCommandEngine
Methods inherited from class heronarts.glx.ui.UI2dComponent
addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, assertValidContainer, clipTextToWidth, clipTextToWidth, contains, dbch, drawBackground, drawBorder, drawFocus, drawFocusCorners, drawFocusCorners, drawParentBackground, getAbsoluteX, getAbsoluteY, getBackgroundColor, getBorderColor, getBorderWeight, getContainer, getDebugClassHierarchy, getDebugClassHierarchy, getFocusColor, getFocusSize, getFont, getFontColor, getHeight, getMappableParameter, getNextSibling, getParent, getPrevSibling, getWidth, getX, getY, hasBackground, hasBorder, hasFont, hasFontColor, isMappable, redraw, removeFromContainer, removeFromContainer, setBackground, setBackgroundColor, setBackgroundColor, setBorder, setBorderColor, setBorderColor, setBorderRounding, setBorderRounding, setBorderWeight, setBottomMargin, setContainerIndex, setContainerPosition, setDebug, setDebug, setDescription, setFocusBackground, setFocusBackgroundColor, setFocusBackgroundColor, setFocusColor, setFocusColor, setFocusCorners, setFont, setFontColor, setFontColor, setFontColor, setHeight, setLeftMargin, setMappable, setMargin, setMargin, setMargin, setPosition, setPosition, setPosition, setPosition, setRightMargin, setSize, setTextAlignment, setTextAlignment, setTextOffset, setTopMargin, setVisible, setWidth, setX, setY, vgRoundedRect, vgRoundedRect, vgRoundedRect
Methods inherited from class heronarts.glx.ui.UIObject
addListener, addListener, addLoopTask, blur, bringToFront, focus, getFocusedChild, getLX, getUI, hasDirectFocus, hasFocus, isVisible, loop, onBlur, onFocus, onUIResize, removeLoopTask, requireUIThread, setConsumeMousePress, setDebugId, toggleVisible, toString
Methods inherited from class heronarts.glx.ui.UIEventHandler
onKeyReleased, onMouseDragged, onMouseMoved, onMouseOut, onMouseOver, onMouseScroll
-
Constructor Details
-
UIToggleSet
public UIToggleSet() -
UIToggleSet
public UIToggleSet(float x, float y, float w, float h) -
UIToggleSet
-
UIToggleSet
-
-
Method Details
-
setActiveColor
-
setActiveColor
-
getDescription
Description copied from class:UIObject
Objects are encouraged to override this method providing a helpful String displayed to the user explaining the function of this UI component. If no help is available, return null rather than an empty String.- Overrides:
getDescription
in classUIObject
- Returns:
- Helpful contextual string explaining function of this element
-
onResize
protected void onResize()Description copied from class:UI2dComponent
Subclasses may override this method, invoked when the component is resized- Overrides:
onResize
in classUI2dComponent
-
setOptions
-
getParameter
- Specified by:
getParameter
in classUIParameterComponent
-
setParameter
-
onParameterChanged
Description copied from interface:LXParameterListener
Invoked when the value of a parameter is changed.- Specified by:
onParameterChanged
in interfaceLXParameterListener
- Parameters:
parameter
- The parameter that has changed its value
-
setEvenSpacing
-
setEvenSpacing
-
getSelectedIndex
public int getSelectedIndex()Gets the index of the currently selected value in the toggle set- Returns:
- currently selected index
-
getSelectedOption
Get the currently selected option in the toggle set- Returns:
- Currently selected value
-
setSelectedOption
Sets the value of the control to the given value in the toggle set- Parameters:
option
- String value, must be one of the options in the toggle set- Returns:
- this
-
setSelectedIndex
Sets the selected index in the toggle set- Parameters:
index
- Index in the toggle set, from 0 to range-1- Returns:
- this
-
onDraw
Description copied from class:UI2dComponent
Subclasses should override this method to perform their drawing functions.- Overrides:
onDraw
in classUI2dComponent
- Parameters:
ui
- UI contextvg
- Graphics context
-
onToggle
protected void onToggle(int value) -
onToggle
-
onMousePressed
Description copied from class:UIEventHandler
Subclasses override to receive mouse events- Overrides:
onMousePressed
in classUIParameterComponent
- Parameters:
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinate
-
onKeyPressed
Description copied from class:UIEventHandler
Subclasses override to receive key events- Overrides:
onKeyPressed
in classUIEventHandler
- Parameters:
keyEvent
- Key eventkeyChar
- Key characterkeyCode
- Key code value
-
getControlTarget
- Specified by:
getControlTarget
in interfaceUIControlTarget
-
dispose
public void dispose()
-