public class UIToggleSet extends UIParameterComponent implements UIFocus, UIControlTarget, LXParameterListener
UIContextActions.Action
DEFAULT_HEIGHT, useCommandEngine
bottomMargin, height, leftMargin, rightMargin, textAlignHorizontal, textAlignVertical, textOffsetX, textOffsetY, topMargin, width, x, y
children, hasFocus, mousePressContextMenu, visible
Constructor and Description |
---|
UIToggleSet() |
UIToggleSet(float x,
float y,
float w,
float h) |
Modifier and Type | Method and Description |
---|---|
LXParameter |
getControlTarget() |
String |
getDescription()
Objects are encouraged to override this method providing a helpful String displayed to the user explaining
the function of this UI component.
|
DiscreteParameter |
getParameter() |
int |
getSelectedIndex()
Gets the index of the currently selected value in the toggle set
|
String |
getSelectedOption()
Get the currently selected option in the toggle set
|
void |
onDraw(UI ui,
PGraphics pg)
Subclasses should override this method to perform their drawing functions.
|
protected void |
onKeyPressed(KeyEvent keyEvent,
char keyChar,
int keyCode)
Subclasses override to receive key events
|
protected void |
onMousePressed(MouseEvent mouseEvent,
float mx,
float my)
Subclasses override to receive mouse events
|
void |
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 resized
|
protected void |
onToggle(int value)
Invoked when value is toggled.
|
protected void |
onToggle(String option)
Invoked when value is toggled, if subclass did not override the integer
version of this method.
|
UIToggleSet |
setEvenSpacing() |
UIToggleSet |
setOptions(String[] options) |
UIToggleSet |
setParameter(DiscreteParameter parameter) |
UIToggleSet |
setSelectedIndex(int index)
Sets the control to the given index in the options
|
UIToggleSet |
setSelectedOption(String option)
Sets the control to select the given option in the toggle set
|
getContextActions, getOscAddress, onMouseReleased, setNormalizedCommand, setUseCommandEngine
addToContainer, addToContainer, breakTextToWidth, clipTextToWidth, contains, drawBackground, drawBorder, drawFocus, drawFocusCorners, drawFocusCorners, getBackgroundColor, getBorderColor, getBorderRounding, getBorderWeight, getContainer, getFocusColor, getFocusSize, getFont, getFontColor, getHeight, getNextSibling, getParent, getPrevSibling, getWidth, getX, getY, hasBackground, hasBorder, hasFont, hasFontColor, isMappable, redraw, removeFromContainer, setBackground, setBackgroundColor, setBorder, setBorderColor, setBorderRounding, setBorderWeight, setBottomMargin, setContainerIndex, setDescription, setFocusBackground, setFocusBackgroundColor, setFocusColor, setFocusCorners, setFont, setFontColor, setFontColor, setHeight, setLeftMargin, setMappable, setMargin, setMargin, setMargin, setPosition, setPosition, setPosition, setPosition, setRightMargin, setSize, setTextAlignment, setTextAlignment, setTextOffset, setTopMargin, setVisible, setWidth, setX, setY
addLoopTask, beginDraw, blur, bringToFront, consumeKeyEvent, consumeMousePress, consumeMouseWheelEvent, endDraw, focus, getFocusedChild, getLX, getUI, hasDirectFocus, hasFocus, isVisible, keyEventConsumed, loop, mousePressConsumed, onBlur, onFocus, onUIResize, removeLoopTask, toggleVisible
onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragged, onMouseMoved, onMouseOut, onMouseOver, onMouseWheel
public UIToggleSet()
public UIToggleSet(float x, float y, float w, float h)
public String getDescription()
UIObject
getDescription
in class UIObject
protected void onResize()
UI2dComponent
onResize
in class UI2dComponent
public UIToggleSet setOptions(String[] options)
public DiscreteParameter getParameter()
getParameter
in class UIParameterComponent
public UIToggleSet setParameter(DiscreteParameter parameter)
public void onParameterChanged(LXParameter parameter)
LXParameterListener
onParameterChanged
in interface LXParameterListener
parameter
- The parameter that has changed its valuepublic UIToggleSet setEvenSpacing()
public int getSelectedIndex()
public String getSelectedOption()
public UIToggleSet setSelectedOption(String option)
option
- String value, must be one of the options in the toggle setpublic UIToggleSet setSelectedIndex(int index)
index
- Index in the toggle set, from 0 to range-1public void onDraw(UI ui, PGraphics pg)
UIObject
protected void onToggle(int value)
value
- Selected index in the toggle setprotected void onToggle(String option)
option
- Selected option in the toggle setprotected void onMousePressed(MouseEvent mouseEvent, float mx, float my)
UIEventHandler
onMousePressed
in class UIParameterComponent
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinateprotected void onKeyPressed(KeyEvent keyEvent, char keyChar, int keyCode)
UIEventHandler
onKeyPressed
in class UIEventHandler
keyEvent
- Key eventkeyChar
- Key characterkeyCode
- Key code valuepublic LXParameter getControlTarget()
getControlTarget
in interface UIControlTarget
LX library by Mark C. Slee. © 2012-2020