controlP5
Class Toggle

java.lang.Object
  extended by controlP5.Controller
      extended by controlP5.Toggle
All Implemented Interfaces:
CDrawable, ControllerInterface, ControlP5Constants

public class Toggle
extends Controller

a toggle can have two states, true and false, where true has the value 1 and false is 0.


Field Summary
 
Fields inherited from class controlP5.Controller
MOVE, PRESSED, RELEASE
 
Fields inherited from interface controlP5.ControlP5Constants
acceptClassList, ALT, ARRAY, BACKSPACE, BOOLEAN, CONTROL, DECREASE, DELETE, DOWN, ENTER, ESCAPE, eventMethod, FIELD, FLOAT, HALF_PI, HIDE, INCREASE, INTEGER, INVALID, KEYCONTROL, LEFT, LOAD, MENU, METHOD, PI, PRINT, RESET, RIGHT, SAVE, SHIFT, STRING, SWITCH_BACK, SWITCH_FORE, TAB, TWO_PI, UP, VERBOSE
 
Constructor Summary
Toggle(ControlP5 theControlP5, Tab theParent, java.lang.String theName, float theValue, float theX, float theY, int theWidth, int theHeight)
           
 
Method Summary
 void addToXMLElement(ControlP5XMLElement theElement)
           
 void draw(processing.core.PApplet theApplet)
           
 boolean getState()
           
 float internalValue()
           
 void mousePressed()
           
 void setInternalValue(float theInternalValue)
          by default a toggle returns 0 (for off) and 1 (for on).
 void setState(boolean theFlag)
          set the state of the toggle, which can be true or false.
 void setValue(float theValue)
          set the value of the controller.
 void toggle()
          switch the state of a toggle.
 void update()
          updates the value of the controller without having to set the value explicitly.
 
Methods inherited from class controlP5.Controller
absolutePosition, add, addListener, arrayValue, behavior, captionLabel, changeValue, color, continuousUpdateEvents, controlWindow, defaultValue, disableSprite, enableSprite, getAsXML, getColor, getHeight, getTab, getWidth, getWindow, hide, id, init, isBroadcast, isInside, isMousePressed, isUpdate, isVisible, isXMLsavable, keyEvent, label, listenerSize, max, min, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, name, parent, position, remove, remove, removeBehavior, removeListener, setArrayValue, setBehavior, setBroadcast, setCaptionLabel, setColorActive, setColorBackground, setColorForeground, setColorLabel, setColorValue, setDecimalPrecision, setDefaultValue, setGroup, setGroup, setHeight, setId, setLabel, setLabelVisible, setMax, setMin, setMousePressed, setMoveable, setParent, setPosition, setSprite, setTab, setTab, setUpdate, setValueLabel, setVisible, setWidth, setWindow, setWindow, show, stringValue, trigger, updateAbsolutePosition, updateEvents, updateInternalEvents, value, valueLabel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Toggle

public Toggle(ControlP5 theControlP5,
              Tab theParent,
              java.lang.String theName,
              float theValue,
              float theX,
              float theY,
              int theWidth,
              int theHeight)
Parameters:
theControlP5 - ControlP5
theParent - Tab
theName - String
theValue - float
theX - float
theY - float
theWidth - int
theHeight - int
Method Detail

draw

public void draw(processing.core.PApplet theApplet)
Specified by:
draw in interface CDrawable
Specified by:
draw in interface ControllerInterface
Overrides:
draw in class Controller
Parameters:
theApplet - PApplet

mousePressed

public void mousePressed()

setValue

public void setValue(float theValue)
Description copied from class: Controller
set the value of the controller.

Specified by:
setValue in class Controller
Parameters:
theValue - float

update

public void update()
Description copied from class: Controller
updates the value of the controller without having to set the value explicitly. update does not visually update the controller. the updating status can be set with setUpdate(true/false) and checked with isUpdate().

Specified by:
update in interface ControllerInterface
Overrides:
update in class Controller

setState

public void setState(boolean theFlag)
set the state of the toggle, which can be true or false.

Parameters:
theFlag - boolean

getState

public boolean getState()

toggle

public void toggle()
switch the state of a toggle.


addToXMLElement

public void addToXMLElement(ControlP5XMLElement theElement)
Parameters:
theElement - ControlP5XMLElement

setInternalValue

public void setInternalValue(float theInternalValue)
by default a toggle returns 0 (for off) and 1 (for on). the internal value variable can be used to store an additional value for a toggle event.

Parameters:
theInternalValue -

internalValue

public float internalValue()


processing library controlP5 by Andreas Schlegel. (c) 2010