public abstract class GAbstractControl extends java.lang.Object implements processing.core.PConstants, GConstants
Modifier and Type | Class and Description |
---|---|
static class |
GAbstractControl.Z_Order
Comparator used for controlling the order components are drawn
|
Modifier and Type | Field and Description |
---|---|
static int |
ALL_METHOD |
static int |
CLIP_RUN |
static int |
COMBI_MODES |
static java.lang.String |
DEFAULT_SLIDER_STYLE |
static int |
DRAG_CONTROL |
static int |
DRAW_METHOD |
static char |
EOL |
static int |
EXCP_IN_HANDLER |
static int[][] |
grid |
static int |
GROUP_CONTROL_METHOD |
static int |
I_CL |
static int |
I_COVERED |
static int |
I_CR |
static int |
I_INSIDE |
static int |
I_MODES |
static int |
I_NONE |
static int |
I_TL |
static int |
I_TR |
static int |
INVALID_PAPPLET |
static int |
INVALID_TYPE |
static int |
KEY_METHOD |
static int |
MERGE_RUNS |
static int |
MISSING |
static int |
MOUSE_METHOD |
static int |
NONEXISTANT |
static int |
OFF_CONTROL |
static int |
OVER_CONTROL |
static java.awt.BasicStroke |
pen_1_0 |
static java.awt.BasicStroke |
pen_2_0 |
static java.awt.BasicStroke |
pen_3_0 |
static java.awt.BasicStroke |
pen_4_0 |
static int |
POST_METHOD |
static int |
PRE_METHOD |
static int |
PRESS_CONTROL |
static int |
SCROLLBAR_HORIZONTAL |
static int |
SCROLLBAR_VERTICAL |
static java.lang.String |
SLIDER_STYLES |
java.lang.String |
tag
Simple tag that can be used by the user
|
int |
tagNo
Allows user to specify a number for this component
|
static int |
TINT_FOR_ALPHA |
static int |
TPAD2 |
static int |
TPAD4 |
static int |
TPAD6 |
static int |
TPAD8 |
static float |
WHEEL_DELTA |
static float |
WHEEL_STICK_FACTOR |
static int |
Z_PANEL |
static int |
Z_SLIPPY |
static int |
Z_SLIPPY_EXPANDS |
static int |
Z_STICKY |
ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ASYNC_SAVEFRAME, DISABLE_BUFFER_READING, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_KEY_REPEAT, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ASYNC_SAVEFRAME, ENABLE_BUFFER_READING, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_KEY_REPEAT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ESC, EXCLUSION, FX2D, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADRATIC_VERTEX, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPAN, SPHERE, SPOT, SQUARE, SUBTRACT, SVG, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z
ALPHA_BLOCK, ALPHA_PICK, BACKGROUND, BLUE_SCHEME, CANCEL, CLOSE_WINDOW, CLOSED, CTRL_ANGULAR, CTRL_HORIZONTAL, CTRL_VERTICAL, CYAN_SCHEME, DECIMAL, END, ERROR, EXIT_APP, EXPONENT, FAMILY, FOREGROUND, FORWARD, GOLD_SCHEME, GREEN_SCHEME, HOME, INFO, INTEGER, KEEP_OPEN, NO, OK, OK_CANCEL, ORANGE_SCHEME, ORIENT_LEFT, ORIENT_RIGHT, ORIENT_TRACK, PLAIN, POSTURE, POSTURE_OBLIQUE, POSTURE_REGULAR, PURPLE_SCHEME, QUERY, RED_SCHEME, REVERSE, SCHEME_10, SCHEME_11, SCHEME_12, SCHEME_13, SCHEME_14, SCHEME_15, SCHEME_8, SCHEME_9, SCROLLBARS_AUTOHIDE, SCROLLBARS_BOTH, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE, SCROLLBARS_VERTICAL_ONLY, SIZE, STRIKETHROUGH, STRIKETHROUGH_OFF, STRIKETHROUGH_ON, SUPERSCRIPT, SUPERSCRIPT_OFF, SUPERSCRIPT_SUB, SUPERSCRIPT_SUPER, USER_COL_SCHEME, WARNING, WEIGHT, WEIGHT_BOLD, WEIGHT_DEMIBOLD, WEIGHT_DEMILIGHT, WEIGHT_EXTRA_LIGHT, WEIGHT_EXTRABOLD, WEIGHT_HEAVY, WEIGHT_LIGHT, WEIGHT_MEDIUM, WEIGHT_REGULAR, WEIGHT_SEMIBOLD, WEIGHT_ULTRABOLD, WIDTH, WIDTH_CONDENSED, WIDTH_EXTENDED, WIDTH_REGULAR, WIDTH_SEMI_CONDENSED, WIDTH_SEMI_EXTENDED, X4, X8, YELLOW_SCHEME, YES, YES_NO, YES_NO_CANCEL
Constructor and Description |
---|
GAbstractControl(processing.core.PApplet theApplet)
Base constructor for ALL control ctors that do not have a visible UI but require
access to a PApplet object.
|
GAbstractControl(processing.core.PApplet theApplet,
float p0,
float p1)
Base constructor for ALL control ctors that have a visible UI but whose width and height
are determined elsewhere e.g.
|
GAbstractControl(processing.core.PApplet theApplet,
float p0,
float p1,
float p2,
float p3)
Base constructor for ALL control ctors that have a visible UI.
|
Modifier and Type | Method and Description |
---|---|
void |
addControl(GAbstractControl c)
Add a control at the position and rotation specified in the control.
|
void |
addControl(GAbstractControl c,
float x,
float y)
Add a control at the given position with zero rotation angle.
|
void |
addControl(GAbstractControl c,
float x,
float y,
float angle)
This will set the rotation of the control to angle overwriting
any previous rotation set.
|
void |
addControls(GAbstractControl... controls)
Add several control at the position and rotation specified in each control.
|
void |
addEventHandler(java.lang.Object obj,
java.lang.String methodName)
Attempt to create the default event handler for the component class.
|
void |
dispose()
This will remove all references to this control in the library.
|
void |
draw() |
void |
forceBufferUpdate()
This is for emergency use only!!!!
In this version of the library a visual controls is drawn to off-screen buffer and then drawn to the screen by copying the buffer. |
int |
getCursorOver()
Get the shape type when the cursor is over a control
|
float |
getCX()
Get the centre x position of the control.
|
float |
getCY()
Get the centre y position of the control.
|
float |
getHeight() |
int |
getLocalColorScheme()
Get the local color scheme ID number.
|
processing.core.PApplet |
getPApplet()
Get the PApplet that manages this component
|
GAbstractControl |
getParent()
Get the parent control.
|
processing.core.PGraphics |
getSnapshot()
This method should be used sparingly since it is heavy on resources.
|
float |
getWidth() |
float |
getX()
Get the left position of the control.
|
float |
getY()
Get the top position of the control.
|
boolean |
hasFocus()
Does this component have focus
|
boolean |
isDragging() |
boolean |
isEnabled()
Is this component enabled
|
boolean |
isOpaque()
Find out if the component is opaque
|
boolean |
isOver(float x,
float y)
Determines if a particular pixel position is over the panel.
|
boolean |
isVisible() |
void |
keyEvent(processing.event.KeyEvent e) |
void |
markForDisposal()
If the control is permanently no longer required then call
this method to remove it and free up resources.
|
void |
mouseEvent(processing.event.MouseEvent event) |
void |
moveTo(float px,
float py)
Move the control to the given position based on the mode.
|
void |
moveTo(float px,
float py,
GControlMode mode)
Move the control to the given position based on the mode.
|
void |
post() |
void |
pre() |
boolean |
saveSnapshot()
Save a snapshot of the control using class name and sketch runtime as the filename
|
boolean |
saveSnapshot(java.lang.String filename)
Save a snapshot of the control using the specified filename
|
void |
setAlpha(int alpha)
Set the transparency of the component and make it unavailable to
mouse and keyboard events if below the threshold.
|
void |
setAlpha(int alpha,
boolean includeChildren)
Set the transparency of the component and make it unavailable to
mouse and keyboard events if below the threshold.
|
void |
setCursorOver(int cursorOver)
Set the shape type to use when the cursor is over a control
|
void |
setEnabled(boolean enable)
Enable or disable the ability of the component to generate mouse events.
GTextField - it also controls key press events GPanel - controls whether the panel can be moved/collapsed/expanded |
void |
setFocus(boolean focus)
Determines whether this component is to have focus or not
|
void |
setLocalColor(int colorNo,
int color)
Change a specific colour within the scheme.
|
void |
setLocalColorScheme(int cs)
Set the local colour scheme for this control.
|
void |
setLocalColorScheme(int cs,
boolean includeChildren)
Set the local colour scheme for this control.
|
void |
setOpaque(boolean opaque)
Determines whether to show the back colour or not.
|
void |
setRotation(float angle)
Set the rotation to apply when displaying this control.
|
void |
setRotation(float angle,
GControlMode mode)
Set the rotation to apply when displaying this control.
|
void |
setVisible(boolean visible) |
java.lang.String |
toString() |
public java.lang.String tag
public int tagNo
public static final java.lang.String SLIDER_STYLES
public static final java.lang.String DEFAULT_SLIDER_STYLE
public static final int DRAW_METHOD
public static final int MOUSE_METHOD
public static final int PRE_METHOD
public static final int KEY_METHOD
public static final int POST_METHOD
public static final int ALL_METHOD
public static final int GROUP_CONTROL_METHOD
public static final int MISSING
public static final int NONEXISTANT
public static final int INVALID_TYPE
public static final int INVALID_PAPPLET
public static final int EXCP_IN_HANDLER
public static final int OFF_CONTROL
public static final int OVER_CONTROL
public static final int PRESS_CONTROL
public static final int DRAG_CONTROL
public static final int TINT_FOR_ALPHA
public static final int I_NONE
public static final int I_TL
public static final int I_TR
public static final int I_CL
public static final int I_CR
public static final int I_INSIDE
public static final int I_COVERED
public static final int I_MODES
public static final int MERGE_RUNS
public static final int CLIP_RUN
public static final int COMBI_MODES
public static final int[][] grid
public static final java.awt.BasicStroke pen_1_0
public static final java.awt.BasicStroke pen_2_0
public static final java.awt.BasicStroke pen_3_0
public static final java.awt.BasicStroke pen_4_0
public static final int TPAD2
public static final int TPAD4
public static final int TPAD6
public static final int TPAD8
public static final int SCROLLBAR_VERTICAL
public static final int SCROLLBAR_HORIZONTAL
public static final float WHEEL_DELTA
public static final float WHEEL_STICK_FACTOR
public static final char EOL
public static final int Z_STICKY
public static final int Z_SLIPPY
public static final int Z_SLIPPY_EXPANDS
public static final int Z_PANEL
public GAbstractControl(processing.core.PApplet theApplet)
theApplet
- public GAbstractControl(processing.core.PApplet theApplet, float p0, float p1)
public GAbstractControl(processing.core.PApplet theApplet, float p0, float p1, float p2, float p3)
public void draw()
public void mouseEvent(processing.event.MouseEvent event)
public void keyEvent(processing.event.KeyEvent e)
public void pre()
public void post()
public void dispose()
btnDoThisthen to remove the button use the statements
btnDoThis.dispose();
btnDoThis = null;
public void forceBufferUpdate()
public boolean isOver(float x, float y)
public void setLocalColor(int colorNo, int color)
colorNo
- the colour index value (0-15 inlc)color
- ARGB color valuepublic void setLocalColorScheme(int cs)
cs
- the colour scheme to use (0-15 incl.)public void setLocalColorScheme(int cs, boolean includeChildren)
cs
- the colour scheme to use (0-15 incl.)includeChildren
- if do do the same for all descendantspublic int getLocalColorScheme()
public void setAlpha(int alpha)
alpha
- value in the range 0 (transparent) to 255 (opaque)public void setAlpha(int alpha, boolean includeChildren)
alpha
- value in the range 0 (transparent) to 255 (opaque)includeChildren
- if do do the same for all descendantspublic GAbstractControl getParent()
public processing.core.PApplet getPApplet()
public processing.core.PGraphics getSnapshot()
public boolean saveSnapshot()
public boolean saveSnapshot(java.lang.String filename)
public void addEventHandler(java.lang.Object obj, java.lang.String methodName)
obj
- the object to handle the eventmethodName
- the method to execute in the object handler classpublic void setRotation(float angle)
angle
- clockwise angle in radianspublic void setRotation(float angle, GControlMode mode)
angle
- clockwise angle in radiansmode
- PApplet.CORNER / CORNERS / CENTERpublic void moveTo(float px, float py)
px
- the horizontal position to move topy
- the vertical position to move topublic void moveTo(float px, float py, GControlMode mode)
px
- the horizontal position to move topy
- the vertical position to move tomode
- the control modepublic float getX()
public float getY()
public float getCX()
public float getCY()
public float getWidth()
public float getHeight()
public void setVisible(boolean visible)
visible
- the visibility to setpublic boolean isVisible()
public void setOpaque(boolean opaque)
opaque
- public boolean isOpaque()
public boolean isDragging()
public void setEnabled(boolean enable)
enable
- true to enable else falsepublic boolean isEnabled()
public void setFocus(boolean focus)
focus
- public boolean hasFocus()
public void addControl(GAbstractControl c, float x, float y, float angle)
c
- the control to add.x
- the leftmost or centre position depending on controlModey
- the topmost or centre position depending on controlModeangle
- the rotation angle (replaces any the angle specified in control)public void addControl(GAbstractControl c, float x, float y)
c
- the control to add.x
- the leftmost or centre position depending on controlModey
- the topmost or centre position depending on controlModepublic void addControl(GAbstractControl c)
c
- the control to addpublic void addControls(GAbstractControl... controls)
controls
- comma separated list of controlspublic int getCursorOver()
public void setCursorOver(int cursorOver)
cursorOver
- the shape type to usepublic void markForDisposal()
btnDoThisthen to remove the button use the statements
btnDoThis.dispose();
btnDoThis = null;
public java.lang.String toString()
toString
in class java.lang.Object
Processing library G4P by Peter Lager. (c) 2017