public class GKnob extends GValueControl
270 | 180 --+-- 0 | 90
GAbstractControl.Z_Order
tag, tagNo
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_2D, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_CACHE, DISABLE_TEXTURE_MIPMAPS, DISABLE_TRANSFORM_CACHE, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ACCURATE_2D, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_CACHE, ENABLE_TEXTURE_MIPMAPS, ENABLE_TRANSFORM_CACHE, ENTER, EPSILON, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, 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, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPHERE, SPOT, SQUARE, SUBTRACT, TAB, TARGA, 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, CLOSE_WINDOW, CTRL_ANGULAR, CTRL_HORIZONTAL, CTRL_VERTICAL, CYAN_SCHEME, DECIMAL, EXIT_APP, EXPONENT, FAMILY, FOREGROUND, GOLD_SCHEME, GREEN_SCHEME, INTEGER, KEEP_OPEN, ORANGE_SCHEME, ORIENT_LEFT, ORIENT_RIGHT, ORIENT_TRACK, POSTURE, POSTURE_OBLIQUE, POSTURE_REGULAR, PURPLE_SCHEME, RED_SCHEME, SCHEME_10, SCHEME_11, SCHEME_12, SCHEME_13, SCHEME_14, SCHEME_15, SCHEME_8, SCHEME_9, SCROLLBAR_HORIZONTAL, SCROLLBAR_VERTICAL, 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, 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, YELLOW_SCHEME
ALL_METHOD, CLIP_RUN, COMBI_MODES, DRAW_METHOD, EXCP_IN_HANDLER, grid, I_CL, I_COVERED, I_CR, I_INSIDE, I_MODES, I_NONE, I_TL, I_TR, KEY_METHOD, MERGE_RUNS, MISSING, MOUSE_METHOD, NONEXISTANT, OFF_CONTROL, OVER_CONTROL, pen_1_0, pen_2_0, pen_3_0, pen_4_0, POST_METHOD, PRE_METHOD, PRESS_CONTROL, RUNTIME_ERROR, TINT_FOR_ALPHA
Constructor and Description |
---|
GKnob(PApplet theApplet,
float p0,
float p1,
float p2,
float p3,
float gripAmount)
Will create the a circular knob control that fits the rectangle define by
the values passed as parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
draw() |
float |
getSensitivity()
This gets the sensitivity to be used in modes CTRL_HORIZONTAL and CTRL_VERTICAL
|
int |
getTurnMode()
Get the current mouse controller mode possible values are
GKnob.CTRL_ANGULAR or GKnob.CTRL_HORIZONTAL) orGKnob.CTRL_VERTICAL |
boolean |
isIncludeOverBezel()
Is the bezel included when considering when the mouse is over.
|
boolean |
isOverArcOnly()
Does the mouse only respond when over the arc?
|
boolean |
isShowArcOnly()
Are we showing arc only?
|
boolean |
isShowTrack()
Are we showing the the value track bar.
|
void |
mouseEvent(MouseEvent event) |
void |
setArcPolicy(boolean over_arc_only,
boolean draw_arc_only,
boolean overfullsize)
Convenience method to set both the show and the mouse over arc only properties
for this knob
|
void |
setGripAmount(float gripAmount)
The radius of the inner griper radius is calculated from the bezel radius
and the parameter gripAmount using
|
void |
setIncludeOverBezel(boolean overBezel)
Whether to include the bezel when deciding when the mouse is over.
|
void |
setOverArcOnly(boolean arcOnly)
Decides when the knob will respond to the mouse buttons.
|
void |
setSensitivity(float sensitivity)
This gets the sensitivity to be used in modes CTRL_HORIZONTAL and CTRL_VERTICAL
A value of 1 is 1 degree per pixel and a value of 2 is 2 degrees per pixel. |
void |
setShowArcOnly(boolean arcOnly)
This will decide whether the knob is draw as a full circle or as an arc.
|
void |
setShowTrack(boolean showTrack)
Whether or not to show the circular progress bar.
|
void |
setTurnMode(int mode)
Set the mouse control mode to use, acceptable values are
GKnob.CTRL_ANGULAR or GKnob.CTRL_HORIZONTAL) orGKnob.CTRL_VERTICAL any other value will be ignored. |
void |
setTurnRange(float start,
float end)
Set the limits for the range of valid rotation angles for the knob.
|
void |
setValue(float v)
Set the value for the slider.
|
getEasing, getEndLimit, getNbrTicks, getPrecision, getStartLimit, getUnit, getValueF, getValueI, getValueS, getValueType, isShowLimits, isShowTicks, isShowValue, isStickToTicks, pre, setEasing, setLimits, setLimits, setLimits, setLimits, setNbrTicks, setNumberFormat, setNumberFormat, setNumberFormat, setPrecision, setShowDecor, setShowLimits, setShowTicks, setShowValue, setStickToTicks, setUnits
addControl, addControl, addControl, addControls, addEventHandler, forceBufferUpdate, getCursorOver, getCX, getCY, getFocusName, getHeight, getLocalColorScheme, getPApplet, getParent, getSnapshot, getWidth, getX, getY, hasFocus, isDragging, isEnabled, isOpaque, isVisible, keyEvent, markForDisposal, post, setAlpha, setAlpha, setAvailable, setAvailableChildren, setCursorOver, setEnabled, setFocus, setLocalColorScheme, setLocalColorScheme, setOpaque, setRotation, setRotation, setVisible, toString
public GKnob(PApplet theApplet, float p0, float p1, float p2, float p3, float gripAmount)
bezel radius = min(width, height)/2 - 2
The radius of the inner griper radius is calculated from the bezel radius and the last parameter.
grip radius = bezel radiius * gripAmount
The gripAmount should be in te range 0.0 to 1.0 inclusive. The actual value will be constrained to that range.
theApplet
- p0
- p1
- p2
- p3
- gripAmount
- must be >=0.0 and <=1.0public void setGripAmount(float gripAmount)
grip radius = bezel radiius * gripAmount
gripAmount
- must be >=0.0 and <=1.0public void setValue(float v)
setValue
in class GValueControl
v
- public void setShowTrack(boolean showTrack)
showTrack
- true for visiblepublic boolean isShowTrack()
public void setIncludeOverBezel(boolean overBezel)
overBezel
- true if bezel inclded.public boolean isIncludeOverBezel()
public void setOverArcOnly(boolean arcOnly)
arcOnly
- public boolean isOverArcOnly()
public void setArcPolicy(boolean over_arc_only, boolean draw_arc_only, boolean overfullsize)
over_arc_only
- mouse over arc only?draw_arc_only
- draw arc only?overfullsize
- include bezel in mouse over calculations?public void setShowArcOnly(boolean arcOnly)
arcOnly
- true for arc onlypublic boolean isShowArcOnly()
public void mouseEvent(MouseEvent event)
mouseEvent
in class GAbstractControl
public void draw()
draw
in class GAbstractControl
public int getTurnMode()
public void setTurnMode(int mode)
mode
- the mode to setpublic float getSensitivity()
public void setSensitivity(float sensitivity)
sensitivity
- the sensitivity to setpublic void setTurnRange(float start, float end)
start
- the range start angle in degreesend
- the range end angle in degreesProcessing library G4P by Peter Lager. (C) 2012