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.UIDragReorderNested classes/interfaces inherited from interface heronarts.glx.ui.UIContextActions
UIContextActions.Action, UIContextActions.ContextAction -
Field Summary
Fields inherited from class heronarts.glx.ui.component.UIParameterComponent
DEFAULT_HEIGHT, useCommandEngineFields inherited from class heronarts.glx.ui.UI2dComponent
borderRoundingBottomLeft, borderRoundingBottomRight, borderRoundingTopLeft, borderRoundingTopRight, debug, debugName, hasBorderRounding, height, marginBottom, marginLeft, marginRight, marginTop, redraw, scissor, textAlignHorizontal, textAlignVertical, textOffsetX, textOffsetY, width, x, y -
Constructor Summary
ConstructorsConstructorDescriptionUIToggleSet(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 TypeMethodDescriptionvoiddispose()Objects are encouraged to override this method providing a helpful String displayed to the user explaining the function of this UI component.intGets the index of the currently selected value in the toggle setGet the currently selected option in the toggle setvoidSubclasses should override this method to perform their drawing functions.protected voidonKeyPressed(KeyEvent keyEvent, char keyChar, int keyCode) Subclasses override to receive key eventsprotected voidonMousePressed(MouseEvent mouseEvent, float mx, float my) Subclasses override to receive mouse eventsvoidonParameterChanged(LXParameter parameter) Invoked when the value of a parameter is changed.protected voidonResize()Subclasses may override this method, invoked when the component is resizedprotected voidonToggle(int value) protected voidsetActiveColor(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, setUseCommandEngineMethods inherited from class heronarts.glx.ui.UI2dComponent
addAfterSibling, addBeforeSibling, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, assertValidContainer, clipTextToWidth, clipTextToWidth, contains, dbch, drawBackground, drawBorder, drawComponentBackground, drawFocus, drawFocusCorners, drawFocusCorners, drawParentBackground, getAbsoluteX, getAbsoluteY, getBackgroundColor, getBorderColor, getBorderWeight, getBottomMargin, getContainer, getDebugClassHierarchy, getDebugClassHierarchy, getFocusColor, getFocusSize, getFont, getFontColor, getHeight, getLeftMargin, getMappableParameter, getNextSibling, getNextSibling, getParent, getPrevSibling, getPrevSibling, getRightMargin, getTopMargin, 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, vgRoundedRectMethods inherited from class heronarts.glx.ui.UIObject
addListener, addListener, addLoopTask, addLoopTask, blur, bringToFront, focus, getFocusedChild, getLX, getUI, hasDirectFocus, hasFocus, isVisible, isVisible, loop, onBlur, onFocus, onUIResize, removeLoopTask, requireUIThread, setConsumeMousePress, setDebugId, setMouseCursor, toggleVisible, toStringMethods inherited from class heronarts.glx.ui.UIEventHandler
onGamepadAxisChanged, onGamepadButtonPressed, onGamepadButtonReleased, 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:UIObjectObjects 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:
getDescriptionin classUIObject- Returns:
- Helpful contextual string explaining function of this element
-
onResize
protected void onResize()Description copied from class:UI2dComponentSubclasses may override this method, invoked when the component is resized- Overrides:
onResizein classUI2dComponent
-
setOptions
-
getParameter
- Specified by:
getParameterin classUIParameterComponent
-
setParameter
-
onParameterChanged
Description copied from interface:LXParameterListenerInvoked when the value of a parameter is changed.- Specified by:
onParameterChangedin 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:UI2dComponentSubclasses should override this method to perform their drawing functions.- Overrides:
onDrawin classUI2dComponent- Parameters:
ui- UI contextvg- Graphics context
-
onToggle
protected void onToggle(int value) -
onToggle
-
onMousePressed
Description copied from class:UIEventHandlerSubclasses override to receive mouse events- Overrides:
onMousePressedin classUIParameterComponent- Parameters:
mouseEvent- Mouse eventmx- x-coordinatemy- y-coordinate
-
onKeyPressed
Description copied from class:UIEventHandlerSubclasses override to receive key events- Overrides:
onKeyPressedin classUIEventHandler- Parameters:
keyEvent- Key eventkeyChar- Key characterkeyCode- Key code value
-
getControlTarget
- Specified by:
getControlTargetin interfaceUIControlTarget
-
dispose
public void dispose()
-