public final class ControlWindow
extends java.lang.Object
/**
* ControlP5 ControlWindow
* by andreas schlegel, 2012
*/
import controlP5.*;
ControlP5 cp5;
int myColorBackground = color(0, 0, 0);
ControlWindow controlWindow;
public int sliderValue = 40;
void setup() {
size(700, 400);
cp5 = new ControlP5(this);
// PLEASE READ
//
// With controlP5 2.0 the ControlWindow has been removed,
// please see the changelog.txt for details.
// Instead, see the extra/ControlP5frame example for
// a ControlWindow alternative.
// controlWindow = cp5.addControlWindow("controlP5window", 100, 100, 400, 200)
// .hideCoordinates()
// .setBackground(color(40))
// ;
cp5.addSlider("sliderValue")
.setRange(0, 255)
.setPosition(40, 40)
.setSize(200, 29)
//.moveTo(controlWindow)
;
}
void draw() {
background(sliderValue);
}
void myTextfield(String theValue) {
println(theValue);
}
void myWindowTextfield(String theValue) {
println("from controlWindow: "+theValue);
}
void keyPressed() {
// if (key==',') cp5.window("controlP5window").hide();
// if (key=='.') cp5.window("controlP5window").show();
// controlWindow = controlP5.addControlWindow("controlP5window2",600,100,400,200);
// controlP5.controller("sliderValue1").moveTo(controlWindow);
// if (key=='d') {
// if (controlWindow.isUndecorated()) {
// controlWindow.setUndecorated(false);
// } else {
// controlWindow.setUndecorated(true);
// }
// }
// if (key=='t') {
// controlWindow.toggleUndecorated();
// }
}
Modifier and Type | Class and Description |
---|---|
class |
ControlWindow.Pointer
A pointer by default is linked to the mouse and
stores the x and y position as well as the pressed
and released state.
|
Modifier and Type | Field and Description |
---|---|
int |
background |
Constructor and Description |
---|
ControlWindow(ControlP5 theControlP5,
processing.core.PApplet theApplet) |
Modifier and Type | Method and Description |
---|---|
ControlWindow |
activateTab(java.lang.String theTab) |
Tab |
add(Tab theTab) |
ControlWindow |
addCanvas(Canvas theCanvas) |
Tab |
addTab(java.lang.String theTab) |
ControlWindow |
clear()
clear the control window, delete all controllers from
a control window.
|
void |
clearKeys() |
ControlWindow |
disableMouseWheel()
Deprecated.
|
ControlWindow |
disablePointer() |
void |
draw() |
void |
draw(processing.core.PGraphics pg) |
void |
draw(processing.core.PGraphics pg,
int theX,
int theY) |
ControlWindow |
enableMouseWheel()
Deprecated.
|
ControlWindow |
enablePointer() |
ControlWindow |
frameRate(int theFrameRate)
sets the frame rate of the control window.
|
Tab |
getCurrentTab() |
ControllerInterface<?> |
getFirstFromMouseOverList() |
java.util.List<ControllerInterface<?>> |
getMouseOverList()
A list of controllers that are registered with a
mouseover.
|
ControlWindow.Pointer |
getPointer() |
processing.core.PVector |
getPositionOfTabs()
Returns the position of the tab bar as PVector.
|
Tab |
getTab(java.lang.String theTabName) |
ControllerList |
getTabs() |
void |
handleKeyEvent(processing.event.KeyEvent theKeyEvent) |
ControlWindow |
hide()
hide the controllers and tabs of the ControlWindow.
|
boolean |
isDrawBackground() |
boolean |
isMouseOver()
returns true if the mouse is inside a controller.
|
boolean |
isMouseOver(ControllerInterface<?> theController) |
boolean |
isMousePressed() |
boolean |
isMouseWheel()
Deprecated.
|
boolean |
isUndecorated() |
boolean |
isUpdate()
check the update status of a control window.
|
boolean |
isVisible() |
void |
keyEvent(processing.event.KeyEvent theKeyEvent) |
void |
mouseEvent(int theX,
int theY,
boolean pressed)
when in Android mode, call mouseEvent(int, int,
boolean).
|
void |
mouseEvent(processing.event.MouseEvent theMouseEvent) |
java.lang.String |
name()
returns the name of the control window.
|
processing.core.PApplet |
papplet()
get the papplet instance of the ControlWindow.
|
ControlWindow |
pre() |
void |
remove() |
ControlWindow |
removeCanvas(Canvas theCanvas) |
ControlWindow |
removeMouseOverFor(ControllerInterface<?> theController) |
ControlWindow |
removeTab(Tab theTab) |
void |
resetMouseOver() |
ControlWindow |
setBackground(int theValue)
set the background color of the control window.
|
ControlWindow |
setColorActive(int theColor)
set the color for the controller while active.
|
ControlWindow |
setColorBackground(int theColor)
set the background color of the controller.
|
ControlWindow |
setColorForeground(int theColor)
set the foreground color of the controller.
|
ControlWindow |
setColorLabel(int theColor)
set the color of the text label of the controller.
|
ControlWindow |
setColorValue(int theColor)
set the color of the values.
|
ControlWindow |
setContext(CDrawable theDrawable)
Adds a custom context to a ControlWindow.
|
ControlWindow |
setDrawBackground(boolean theFlag)
by default the background of a controlWindow is
filled with a background color every frame.
|
ControlWindow |
setLocation(int theX,
int theY) |
ControlWindow |
setPosition(int theX,
int theY) |
ControlWindow |
setPositionOfTabs(int theX,
int theY) |
ControlWindow |
setPositionOfTabs(processing.core.PVector thePVector)
Sets the position of the tab bar which is set to 0,0
by default.
|
ControlWindow |
setUndecorated(boolean theFlag) |
void |
setUpdate(boolean theFlag)
enable or disable the update function of a control
window.
|
ControlWindow |
show() |
ControlWindow |
toggleUndecorated() |
void |
update()
updates all controllers inside the control window if
update is enabled.
|
void |
updateEvents() |
public ControlWindow(ControlP5 theControlP5, processing.core.PApplet theApplet)
public ControlWindow activateTab(java.lang.String theTab)
public ControlWindow addCanvas(Canvas theCanvas)
public Tab addTab(java.lang.String theTab)
public ControlWindow clear()
public void clearKeys()
@Deprecated public ControlWindow disableMouseWheel()
public ControlWindow disablePointer()
public void draw()
public void draw(processing.core.PGraphics pg)
public void draw(processing.core.PGraphics pg, int theX, int theY)
@Deprecated public ControlWindow enableMouseWheel()
public ControlWindow enablePointer()
public ControlWindow frameRate(int theFrameRate)
theFrameRate
- public Tab getCurrentTab()
public ControllerInterface<?> getFirstFromMouseOverList()
public java.util.List<ControllerInterface<?>> getMouseOverList()
public ControlWindow.Pointer getPointer()
public processing.core.PVector getPositionOfTabs()
public Tab getTab(java.lang.String theTabName)
public ControllerList getTabs()
public void handleKeyEvent(processing.event.KeyEvent theKeyEvent)
theKeyEvent
- KeyEventpublic ControlWindow hide()
public boolean isDrawBackground()
public boolean isMouseOver()
public boolean isMouseOver(ControllerInterface<?> theController)
public boolean isMousePressed()
@Deprecated public boolean isMouseWheel()
public boolean isUndecorated()
public boolean isUpdate()
public boolean isVisible()
public void keyEvent(processing.event.KeyEvent theKeyEvent)
public void mouseEvent(int theX, int theY, boolean pressed)
public void mouseEvent(processing.event.MouseEvent theMouseEvent)
public java.lang.String name()
public processing.core.PApplet papplet()
public ControlWindow pre()
public void remove()
public ControlWindow removeCanvas(Canvas theCanvas)
public ControlWindow removeMouseOverFor(ControllerInterface<?> theController)
public ControlWindow removeTab(Tab theTab)
public void resetMouseOver()
public ControlWindow setBackground(int theValue)
public ControlWindow setColorActive(int theColor)
public ControlWindow setColorBackground(int theColor)
public ControlWindow setColorForeground(int theColor)
public ControlWindow setColorLabel(int theColor)
public ControlWindow setColorValue(int theColor)
public ControlWindow setContext(CDrawable theDrawable)
theDrawable
- CDrawableCDrawable
public ControlWindow setDrawBackground(boolean theFlag)
theFlag
- public ControlWindow setLocation(int theX, int theY)
public ControlWindow setPosition(int theX, int theY)
public ControlWindow setPositionOfTabs(int theX, int theY)
public ControlWindow setPositionOfTabs(processing.core.PVector thePVector)
thePVector
- public ControlWindow setUndecorated(boolean theFlag)
public void setUpdate(boolean theFlag)
public ControlWindow show()
public ControlWindow toggleUndecorated()
public void update()
public void updateEvents()
processing library controlP5 by Andreas Schlegel. (c) 2006-2014