|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectcontrolP5.Controller
public abstract class Controller
Controller is an abstract class that is extended by any available controller within controlP5. this is the full documentation list for all methods available for a controller. An event triggered by a controller will be forwarded to the main program. If a void controlEvent(ControlEvent theEvent) {} method is available, this method will be called.
A Controller can pass a change in value to the main program in 3 different ways: (1) add method controlEvent(ControlEvent theEvent) to your sketch. ControlP5 will automatically detect this method and will used it to forward any controlEvent triggered by a controller - you can disable forwarding by using setBroadcast(false) (see setBroadcast) (2) each controller requires a unique name when being create. In case an existing name is used for a newly created Controller, the existing one will be overwritten. each unique name can be used to automatically link a controller to either a method or a field within your program.
Bang
,
Button
,
Knob
,
Matrix
,
MultiList
,
Numberbox
,
Radio
,
ScrollList
,
Slider
,
Textarea
,
Textfield
,
Textlabel
,
Toggle
,
ControlGroup
,
ControlBehavior
,
ControlEvent
Field Summary | |
---|---|
static int |
MOVE
|
static int |
PRESSED
|
static int |
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 |
Method Summary | |
---|---|
CVector3f |
absolutePosition()
get the absolute position of a controller. |
void |
add(ControllerInterface theElement)
|
void |
addListener(ControlListener theListener)
add a listener to the controller. |
float[] |
arrayValue()
|
ControlBehavior |
behavior()
get the behavior of the controller. |
Label |
captionLabel()
|
void |
changeValue(float theValue)
set the value of the controller without sending the broadcast event. |
CColor |
color()
|
void |
continuousUpdateEvents()
continuousUpdateEvents is used for internal updates of a controller. |
ControlWindow |
controlWindow()
|
float |
defaultValue()
returns the default value. |
void |
disableSprite()
|
void |
draw(processing.core.PApplet theApplet)
|
void |
enableSprite()
|
ControlP5XMLElement |
getAsXML()
|
CColor |
getColor()
|
int |
getHeight()
|
Tab |
getTab()
get the instance of the tab the controller belongs to. |
int |
getWidth()
|
ControlWindow |
getWindow()
get the control window of the controller |
void |
hide()
hide the controller, make it invisible. |
int |
id()
get the id of the controller. |
void |
init()
|
boolean |
isBroadcast()
check if broadcasting is enabled or disabled for a controller. |
boolean |
isInside()
returns true or false and indicates if the mouse is inside the area of a controller. |
boolean |
isMousePressed()
returns true or false if the mouse has been pressed. |
boolean |
isUpdate()
enable the update function for a controller. |
boolean |
isVisible()
check if the controller is visible. |
boolean |
isXMLsavable()
|
void |
keyEvent(java.awt.event.KeyEvent theEvent)
|
java.lang.String |
label()
get the label of the controller. |
int |
listenerSize()
|
float |
max()
|
float |
min()
|
void |
moveTo(ControlGroup theGroup)
|
void |
moveTo(ControlGroup theGroup,
Tab theTab,
ControlWindow theControlWindow)
|
void |
moveTo(ControlWindow theControlWindow)
move a controller to the default tab of a control window - other than the main window. |
void |
moveTo(ControlWindow theControlWindow,
java.lang.String theTabName)
|
void |
moveTo(processing.core.PApplet theApplet)
move a controller to the default tab inside the main window. |
void |
moveTo(processing.core.PApplet theApplet,
java.lang.String theTabName)
move a controller to a defined tab inside the main window. |
void |
moveTo(java.lang.String theTabName)
move a controller to another tab. |
void |
moveTo(Tab theTab)
move a controller to another tab indicated by parameter theTab. |
java.lang.String |
name()
returns the name of the controller. |
ControllerInterface |
parent()
get the parent of a controller. |
CVector3f |
position()
get the position of a controller. |
void |
remove()
remove a controller from controlP5. |
void |
remove(ControllerInterface theElement)
|
void |
removeBehavior()
remove the behavior from the controller. |
void |
removeListener(ControlListener theListener)
remove a listener from the controller. |
void |
setArrayValue(float[] theArray)
|
void |
setBehavior(ControlBehavior theBehavior)
with setBehavior you can add a ControlBehavior to a controller. |
void |
setBroadcast(boolean theFlag)
Use setBroadcast to enable and disable the broadcasting of changes in a controller's value. |
void |
setCaptionLabel(java.lang.String theLabel)
set or change the content of the caption label of a controller. |
void |
setColorActive(int theColor)
set the color for the controller while active. |
void |
setColorBackground(int theColor)
set the background color of the controller. |
void |
setColorForeground(int theColor)
set the foreground color of the controller. |
void |
setColorLabel(int theColor)
set the color of the text label of the controller. |
void |
setColorValue(int theColor)
set the color of the value label of the controller. |
void |
setDecimalPrecision(int theValue)
sets the decimal precision of a controller's float value displayed. |
void |
setDefaultValue(float theValue)
set the default value. |
void |
setGroup(ControllerGroup theGroup)
|
void |
setGroup(java.lang.String theName)
set the group of the controller. |
Controller |
setHeight(int theHeight)
|
void |
setId(int theId)
set the id of the controller. |
void |
setLabel(java.lang.String theLabel)
set the label of the controller. |
void |
setLabelVisible(boolean theValue)
show or hide the labels of a controller. |
void |
setMax(float theValue)
set the maximum level of the Controller. |
void |
setMin(float theValue)
set the minimum level of the Controller. |
boolean |
setMousePressed(boolean theStatus)
|
void |
setMoveable(boolean theValue)
enable or prevent the controller to be moveable. |
void |
setParent(ControllerInterface theParent)
set the parent of a parent of a controller. |
void |
setPosition(float theX,
float theY)
set the position of a controller. |
void |
setSprite(ControllerSprite theSprite)
|
void |
setTab(ControlWindow theWindow,
java.lang.String theName)
|
void |
setTab(java.lang.String theName)
set the tab of the controller. |
void |
setUpdate(boolean theFlag)
disable the update function for a controller. |
abstract void |
setValue(float theValue)
set the value of the controller. |
void |
setValueLabel(java.lang.String theLabel)
set or change the value of the value label of a controller. |
void |
setVisible(boolean theFlag)
set the visibility of a controller. |
Controller |
setWidth(int theWidth)
|
ControlWindow |
setWindow(ControlWindow theWindow)
Deprecated. |
void |
setWindow(processing.core.PApplet theApplet)
Deprecated. |
void |
show()
show the controller. |
java.lang.String |
stringValue()
set the current string value of a controller. |
void |
trigger()
Deprecated. |
void |
update()
updates the value of the controller without having to set the value explicitly. |
void |
updateAbsolutePosition()
|
void |
updateEvents()
updateEvents is used for internal updates of a controller. |
void |
updateInternalEvents(processing.core.PApplet theApplet)
TODO |
float |
value()
get the current value of the controller. |
Label |
valueLabel()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface controlP5.ControllerInterface |
---|
addToXMLElement |
Field Detail |
---|
public static final int MOVE
public static final int RELEASE
public static final int PRESSED
Method Detail |
---|
public final void init()
init
in interface ControllerInterface
public void setBehavior(ControlBehavior theBehavior)
theBehavior
- ControlBehaviorpublic void removeBehavior()
public ControlBehavior behavior()
public float defaultValue()
public void setDefaultValue(float theValue)
theValue
- floatpublic void setMoveable(boolean theValue)
theValue
- booleanpublic void setLabelVisible(boolean theValue)
theValue
- booleanpublic void setBroadcast(boolean theFlag)
theFlag
- booleanpublic boolean isBroadcast()
public CVector3f position()
position
in interface ControllerInterface
public void setPosition(float theX, float theY)
setPosition
in interface ControllerInterface
theX
- floattheY
- floatpublic CVector3f absolutePosition()
absolutePosition
in interface ControllerInterface
public void updateAbsolutePosition()
updateAbsolutePosition
in interface ControllerInterface
public final void continuousUpdateEvents()
continuousUpdateEvents
in interface ControllerInterface
public final void updateEvents()
updateEvents
in interface ControllerInterface
public void updateInternalEvents(processing.core.PApplet theApplet)
updateInternalEvents
in interface ControllerInterface
ControllerInterface.updateInternalEvents
public void draw(processing.core.PApplet theApplet)
draw
in interface CDrawable
draw
in interface ControllerInterface
theApplet
- PAppletpublic void add(ControllerInterface theElement)
add
in interface ControllerInterface
theElement
- ControllerInterfacepublic void remove(ControllerInterface theElement)
remove
in interface ControllerInterface
theElement
- ControllerInterfacepublic void remove()
remove
in interface ControllerInterface
public java.lang.String name()
name
in interface ControllerInterface
public void moveTo(java.lang.String theTabName)
theTabName
- Stringpublic void moveTo(Tab theTab)
theTab
- public void moveTo(processing.core.PApplet theApplet)
theApplet
- public void moveTo(processing.core.PApplet theApplet, java.lang.String theTabName)
theApplet
- theTabName
- public void moveTo(ControlWindow theControlWindow)
theControlWindow
- public void moveTo(ControlWindow theControlWindow, java.lang.String theTabName)
public void moveTo(ControlGroup theGroup, Tab theTab, ControlWindow theControlWindow)
moveTo
in interface ControllerInterface
theGroup
- ControlGrouptheTab
- TabtheControlWindow
- ControlWindowpublic void moveTo(ControlGroup theGroup)
public void setTab(java.lang.String theName)
theName
- Stringpublic void setTab(ControlWindow theWindow, java.lang.String theName)
public void setGroup(java.lang.String theName)
theName
- Stringpublic void setGroup(ControllerGroup theGroup)
public void setWindow(processing.core.PApplet theApplet)
theApplet
- PAppletpublic ControlWindow setWindow(ControlWindow theWindow)
theWindwo
- ControlWindowpublic Tab getTab()
getTab
in interface ControllerInterface
public final void setParent(ControllerInterface theParent)
theParent
- ControllerInterfacepublic ControllerInterface parent()
public ControlWindow getWindow()
getWindow
in interface ControllerInterface
public boolean isInside()
public boolean isMousePressed()
public final boolean setMousePressed(boolean theStatus)
setMousePressed
in interface ControllerInterface
theStatus
- boolean
public void keyEvent(java.awt.event.KeyEvent theEvent)
keyEvent
in interface ControllerInterface
KeyEvent
- theEventpublic void setId(int theId)
setId
in interface ControllerInterface
int
- theIdpublic int id()
id
in interface ControllerInterface
public abstract void setValue(float theValue)
theValue
- floatpublic void setArrayValue(float[] theArray)
public final void changeValue(float theValue)
theValue
- floatpublic void update()
update
in interface ControllerInterface
public void setUpdate(boolean theFlag)
setUpdate
in interface ControllerInterface
theFlag
- booleanpublic boolean isUpdate()
isUpdate
in interface ControllerInterface
public void trigger()
public float value()
value
in interface ControllerInterface
public java.lang.String stringValue()
stringValue
in interface ControllerInterface
public float[] arrayValue()
public CColor color()
color
in interface ControllerInterface
public CColor getColor()
public void setLabel(java.lang.String theLabel)
setLabel
in interface ControllerInterface
theLabel
- Stringpublic void setCaptionLabel(java.lang.String theLabel)
theLabel
- public void setValueLabel(java.lang.String theLabel)
theLabel
- public java.lang.String label()
public void addListener(ControlListener theListener)
theListener
- ControlListenerpublic void removeListener(ControlListener theListener)
theListener
- ControlListenerpublic int listenerSize()
public boolean isVisible()
isVisible
in interface ControllerInterface
public void setVisible(boolean theFlag)
theFlag
- booleanpublic void hide()
hide
in interface ControllerInterface
public void show()
show
in interface ControllerInterface
public void setColorActive(int theColor)
setColorActive
in interface ControllerInterface
theColor
- intpublic void setColorForeground(int theColor)
setColorForeground
in interface ControllerInterface
theColor
- intpublic void setColorBackground(int theColor)
setColorBackground
in interface ControllerInterface
theColor
- intpublic void setColorLabel(int theColor)
setColorLabel
in interface ControllerInterface
theColor
- intpublic void setColorValue(int theColor)
setColorValue
in interface ControllerInterface
theColor
- intpublic Label captionLabel()
public Label valueLabel()
public float max()
public float min()
public void setMin(float theValue)
theValue
- floatpublic void setMax(float theValue)
theValue
- floatpublic Controller setWidth(int theWidth)
public Controller setHeight(int theHeight)
public int getWidth()
public int getHeight()
public void setDecimalPrecision(int theValue)
theValue
- public ControlWindow controlWindow()
public void setSprite(ControllerSprite theSprite)
public void enableSprite()
public void disableSprite()
public boolean isXMLsavable()
isXMLsavable
in interface ControllerInterface
public ControlP5XMLElement getAsXML()
getAsXML
in interface ControllerInterface
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |