guicomponents

## Class GKnob

- java.lang.Object
- - guicomponents.GComponent
  - - guicomponents.GRoundControl
    - - guicomponents.GKnob

- All Implemented Interfaces:
    GConstants, Comparable<Object>, PConstants
  Direct Known Subclasses:
    GKnobOval

      public class GKnob
      extends GRoundControl

  The provides an extremely configurable GUI knob controller. GKnob inherits from GRoundControl so you should read the documentation for that class as it also applies to GKnob.
  Configurable options
  Knob size but it must be circular
  Start and end of rotation arc.
  Bezel width with tick marks
  User defined value limits (i.e. the range of values returned
  Documentation for the following can be found in GRoundControl
  Range of values associated with rotating the knob
  Rotation is controlled by mouse movement - 3 modes available
  (a) angular - drag round knob center
  (b) horizontal - drag left or right
  (c) vertical - drag up or down
  User can specify mouse sensitivity for modes (b) and (c) Use can specify level of inertia to give smoother rotation Note: Angles are measured clockwise starting in the positive x direction i.e.

               270
                |
          180 --+-- 0
                |
                90

  Author:
    Peter Lager

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class guicomponents.GComponent

      `GComponent.Z_Order`

  - ### Field Summary

    - ### Fields inherited from class guicomponents.GRoundControl

      `lastTargetNeedleAngle, needleAngle, targetNeedleAngle, wrap0`

    - ### Fields inherited from class guicomponents.GComponent

      `eventType, fGlobalFont, globalColor, globalColorScheme, globalFont, localColor, localFont, tag, tagNo, z`

    - ### Fields inherited from interface processing.core.PConstants

      `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_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_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`

    - ### Fields inherited from interface guicomponents.GConstants

      `ADD_DUPLICATE, BACKGROUND, CHANGED, CLICKED, CLOSE_WINDOW, COLLAPSED, CTRL_ANGULAR, CTRL_HORIZONTAL, CTRL_VERTICAL, DESELECTED, DISABLE_AUTO_DRAW, DRAGGED, ENTERED, EXCP_IN_HANDLER, EXIT_APP, EXPANDED, FAMILY, FOREGROUND, HUD_UNSUPPORTED, INVALID_STATUS, JUSTIFICATION, JUSTIFICATION_FULL, JUSTIFICATION_NONE, KEEP_OPEN, MISSING, NONEXISTANT, NOT_PEASYCAM, POSTURE, POSTURE_OBLIQUE, POSTURE_REGULAR, PRESSED, RELEASED, RUNTIME_ERROR, SCROLL_DOWN, SCROLL_LEFT, SCROLL_RIGHT, SCROLL_UP, SCROLLBAR_HORIZONTAL, SCROLLBAR_VERTICAL, SCROLLBARS_AUTOHIDE, SCROLLBARS_BOTH, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE, SCROLLBARS_VERTICAL_ONLY, SELECTED, SET, SIZE, STRIKETHROUGH, STRIKETHROUGH_OFF, STRIKETHROUGH_ON, SUPERSCRIPT, 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`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GKnob(PApplet theApplet, int x, int y, int size, int arcStart, int arcEnd)` Create a GKnob control Will ensure that width and height are >= 20 pixels The arcStart and arcEnd represent the limits of rotation expressed in degrees as shown above.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `draw()` Draw the knob
    `int` | `getBezelWidth()`
    `boolean` | `isOver(int ax, int ay)` Determines whether the position ax, ay is over any part of the round control.
    `boolean` | `isOverRotArc(int ax, int ay)` Determines if the position is over the round control and within the rotation range.
    `boolean` | `isRotArcOnly()`
    `boolean` | `isValueTrackVisible()` See if the value track is visible
    `void` | `setBezelWidth(int bw)` Set the width of the bezel.
    `void` | `setMouseORA(boolean strict)` If this is set to false (the default value) then the mouse button can be pressed over any part of the knob and bezel to start rotating the knob.
    `void` | `setNbrTickMarks(int nbr_ticks)` Set the number of tick markers
    `void` | `setNbrTickSpaces(int nbr_spaces)` Set the number of tick spaces for the bezel.
    `void` | `setRotArcOnly(boolean rotArcOnly)`
    `void` | `setValueTrackVisible(boolean visible)` Determines whether the value track is shown or not

    - ### Methods inherited from class guicomponents.GRoundControl

      `getControlMode, getInertia, getSensitivity, getValue, getValuef, isMouseORA, isValueChanging, mouseEvent, pre, setControlMode, setInertia, setLimits, setSensitivity, setValue, setValue`

    - ### Methods inherited from class guicomponents.GComponent

      `add, addAbsoluteControl, addCompoundControl, addEventHandler, addEventHandler, addRelativeControl, addXXX, calcAbsPosition, changeWindow, compareTo, contains, ctrlMode, dispose, getAlpha, getBorder, getCtrlMode, getEventType, getFocusObject, getHeight, getOpaque, getPApplet, getParent, getStyledText, getText, getTransform, getWidth, getX, getY, hasFocus, hasKeyFocus, isEnabled, isVisible, keyPressed, remove, setAlpha, setBorder, setColorScheme, setEnabled, setFocus, setFont, setFontNew, setFontNew, setHeight, setLocalColorScheme, setOpaque, setRotation, setText, setText, setTextAlign, setTextNew, setTextNew, setVisible, setWidth, setX, setXY, setY, toString`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### GKnob

          public GKnob(PApplet theApplet,
               int x,
               int y,
               int size,
               int arcStart,
               int arcEnd)

      Create a GKnob control
      Will ensure that width and height are >= 20 pixels
      The arcStart and arcEnd represent the limits of rotation expressed in degrees as shown above. For instance if you want a knob that rotates from 7 o'clock to 5 o'clock (via 12 o'clock) then arcStart = 120 and arcEnd = 60 degrees.
      Parameters:
        `theApplet` -
        `x` - left position of knob
        `y` - top position of knob
        `size` - size of knob (will be round)
        `arcStart` - start of rotation arc (in degrees)
        `arcEnd` - end of rotation arc (in degrees)

  - ### Method Detail

    - #### setBezelWidth

          public void setBezelWidth(int bw)

      Set the width of the bezel.
      Parameters:
        `bw` - desired bezel width in pixels.

    - #### getBezelWidth

          public int getBezelWidth()

      Returns:
        the bezelWidth

    - #### setValueTrackVisible

          public void setValueTrackVisible(boolean visible)

      Determines whether the value track is shown or not
      Parameters:
        `visible` - true or false

    - #### isValueTrackVisible

          public boolean isValueTrackVisible()

      See if the value track is visible

    - #### setNbrTickSpaces

          public void setNbrTickSpaces(int nbr_spaces)

      Set the number of tick spaces for the bezel.
      Parameters:
        `nbr_spaces` - number of spaces between ticks

    - #### setNbrTickMarks

          public void setNbrTickMarks(int nbr_ticks)

      Set the number of tick markers
      Parameters:
        `nbr_ticks` -

    - #### isOver

          public boolean isOver(int ax,
                       int ay)

      Determines whether the position ax, ay is over any part of the round control.
      Overrides:
        `isOver` in class `GComponent`
      Parameters:
        `ax` - x coordinate
        `ay` - y coordinate
      Returns:
        true if mouse is over the control else false

    - #### isOverRotArc

          public boolean isOverRotArc(int ax,
                             int ay)

      Determines if the position is over the round control and within the rotation range.
      Specified by:
        `isOverRotArc` in class `GRoundControl`
      Parameters:
        `ax` - x coordinate
        `ay` - y coordinate
      Returns:
        true if mouse is over the rotation arc of the control else false

    - #### setMouseORA

          public void setMouseORA(boolean strict)

      If this is set to false (the default value) then the mouse button can be pressed over any part of the knob and bezel to start rotating the knob. If it is true then only that portion of the knob within the rotation arc.
      It can only be changed if param strict the strictOver to set
      Overrides:
        `setMouseORA` in class `GRoundControl`

    - #### isRotArcOnly

          public boolean isRotArcOnly()

      Returns:
        the rotArcOnly

    - #### setRotArcOnly

          public void setRotArcOnly(boolean rotArcOnly)

      Parameters:
        `rotArcOnly` - the rotArcOnly to set

    - #### draw

          public void draw()

      Draw the knob
      Overrides:
        `draw` in class `GComponent`

Processing library guicomponents by Peter Lager. (C) 2012