public class UIButton extends UIParameterComponent implements UIControlTarget, UITriggerSource, UITriggerTarget, UIFocus
| Modifier and Type | Class and Description |
|---|---|
static class |
UIButton.Action |
static class |
UIButton.Trigger |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
active |
protected int |
activeColor |
protected boolean |
enabled |
protected long |
exactToggleTime |
protected int |
inactiveColor |
protected boolean |
isMomentary |
protected boolean |
momentaryPressValid |
DEFAULT_HEIGHT, useCommandEnginebottomMargin, height, leftMargin, rightMargin, textAlignHorizontal, textAlignVertical, textOffsetX, textOffsetY, topMargin, width, x, ychildren, hasFocus, mousePressContextMenu, visible| Constructor and Description |
|---|
UIButton() |
UIButton(float w,
BooleanParameter p) |
UIButton(float w,
EnumParameter<?> p) |
UIButton(float w,
float h,
BooleanParameter p) |
UIButton(float w,
float h,
EnumParameter<?> p) |
UIButton(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.
|
LXListenableNormalizedParameter |
getParameter() |
BooleanParameter |
getTriggerSource() |
BooleanParameter |
getTriggerTarget() |
boolean |
isActive() |
protected void |
onBlur()
Subclasses override when element loses focus
|
protected void |
onClick()
Subclasses may override when a momentary button is clicked, and the click release
happened within the bounds of the box
|
protected 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 |
onKeyReleased(KeyEvent keyEvent,
char keyChar,
int keyCode)
Subclasses override to receive key events
|
protected void |
onMouseDragged(MouseEvent mouseEvent,
float mx,
float my,
float dx,
float dy)
Subclasses override to receive mouse events
|
protected void |
onMousePressed(MouseEvent mouseEvent,
float mx,
float my)
Subclasses override to receive mouse events
|
protected void |
onMouseReleased(MouseEvent mouseEvent,
float mx,
float my)
Subclasses override to receive mouse events
|
protected void |
onToggle(boolean active)
Subclasses may override this to handle changes to the button's state
|
UIButton |
removeParameter() |
UIButton |
setActive(boolean active) |
protected UIButton |
setActive(boolean active,
boolean pushToParameter) |
UIButton |
setActiveColor(int activeColor) |
UIButton |
setActiveIcon(PImage activeIcon) |
UIButton |
setActiveLabel(String activeLabel) |
UIButton |
setEnabled(boolean enabled) |
UIButton |
setIcon(PImage icon) |
UIButton |
setIconOffset(float iconOffsetX,
float iconOffsetY) |
UIButton |
setIconOffsetX(float iconOffsetX) |
UIButton |
setIconOffsetY(float iconOffsetY) |
UIButton |
setInactiveColor(int inactiveColor) |
UIButton |
setInactiveIcon(PImage inactiveIcon) |
UIButton |
setInactiveLabel(String inactiveLabel) |
UIButton |
setLabel(String label) |
UIButton |
setMomentary(boolean momentary) |
UIButton |
setParameter(BooleanParameter parameter) |
UIButton |
setParameter(EnumParameter<?> parameter) |
UIButton |
setTriggerable(boolean triggerable) |
UIButton |
toggle() |
getContextActions, getOscAddress, setNormalizedCommand, setUseCommandEngineaddToContainer, 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, onResize, 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, setYaddLoopTask, beginDraw, blur, bringToFront, consumeKeyEvent, consumeMousePress, consumeMouseWheelEvent, endDraw, focus, getFocusedChild, getLX, getUI, hasDirectFocus, hasFocus, isVisible, keyEventConsumed, loop, mousePressConsumed, onFocus, onUIResize, removeLoopTask, toggleVisibleonKeyTyped, onMouseClicked, onMouseMoved, onMouseOut, onMouseOver, onMouseWheelprotected boolean active
protected boolean isMomentary
protected int inactiveColor
protected int activeColor
protected boolean enabled
protected boolean momentaryPressValid
protected long exactToggleTime
public UIButton()
public UIButton(float w,
BooleanParameter p)
public UIButton(float w,
float h,
BooleanParameter p)
public UIButton(float w,
EnumParameter<?> p)
public UIButton(float w,
float h,
EnumParameter<?> p)
public UIButton(float x,
float y,
float w,
float h)
public UIButton setEnabled(boolean enabled)
public UIButton setTriggerable(boolean triggerable)
public String getDescription()
UIObjectgetDescription in class UIObjectpublic LXListenableNormalizedParameter getParameter()
getParameter in class UIParameterComponentpublic UIButton removeParameter()
public UIButton setParameter(EnumParameter<?> parameter)
public UIButton setParameter(BooleanParameter parameter)
public UIButton setMomentary(boolean momentary)
public UIButton setIconOffset(float iconOffsetX, float iconOffsetY)
public UIButton setIconOffsetX(float iconOffsetX)
public UIButton setIconOffsetY(float iconOffsetY)
protected void onDraw(UI ui, PGraphics pg)
UIObjectprotected void onBlur()
UIObjectprotected void onMouseDragged(MouseEvent mouseEvent, float mx, float my, float dx, float dy)
UIEventHandleronMouseDragged in class UIEventHandlermouseEvent - Mouse eventmx - x-coordinatemy - y-coordinatedx - movement in xdy - movement in yprotected void onMousePressed(MouseEvent mouseEvent, float mx, float my)
UIEventHandleronMousePressed in class UIParameterComponentmouseEvent - Mouse eventmx - x-coordinatemy - y-coordinateprotected void onMouseReleased(MouseEvent mouseEvent, float mx, float my)
UIEventHandleronMouseReleased in class UIParameterComponentmouseEvent - Mouse eventmx - x-coordinatemy - y-coordinateprotected void onKeyPressed(KeyEvent keyEvent, char keyChar, int keyCode)
UIEventHandleronKeyPressed in class UIEventHandlerkeyEvent - Key eventkeyChar - Key characterkeyCode - Key code valueprotected void onKeyReleased(KeyEvent keyEvent, char keyChar, int keyCode)
UIEventHandleronKeyReleased in class UIEventHandlerkeyEvent - Key eventkeyChar - Key characterkeyCode - Key code valuepublic boolean isActive()
public UIButton setActive(boolean active)
protected UIButton setActive(boolean active, boolean pushToParameter)
public UIButton toggle()
protected void onClick()
protected void onToggle(boolean active)
active - Whether button is activepublic UIButton setActiveColor(int activeColor)
public UIButton setInactiveColor(int inactiveColor)
public LXParameter getControlTarget()
getControlTarget in interface UIControlTargetpublic BooleanParameter getTriggerSource()
getTriggerSource in interface UITriggerSourcepublic BooleanParameter getTriggerTarget()
getTriggerTarget in interface UITriggerTargetLX library by Mark C. Slee. © 2012-2020