G4P (GUI for Processing)  4.3.8
A set of GUI controls for your Processing sketch.
 All Classes Functions Variables Pages
g4p_controls.GAbstractControl Class Reference
Inheritance diagram for g4p_controls.GAbstractControl:

Classes

class  Z_Order
 

Public Member Functions

void addControl (GAbstractControl c, float x, float y, float angle)
 
void addControl (GAbstractControl c, float x, float y)
 
void addControl (GAbstractControl c)
 
void addControls (GAbstractControl...controls)
 
void addEventHandler (Object obj, String methodName)
 
void dispose ()
 
void draw ()
 
void forceBufferUpdate ()
 
 GAbstractControl (PApplet theApplet)
 
 GAbstractControl (PApplet theApplet, float p0, float p1)
 
 GAbstractControl (PApplet theApplet, float p0, float p1, float p2, float p3)
 
int getAlpha ()
 
int getCursorOver ()
 
float getCX ()
 
float getCY ()
 
float getHeight ()
 
int getLocalColorScheme ()
 
PApplet getPApplet ()
 
GAbstractControl getParent ()
 
PGraphics getSnapshot ()
 
float getWidth ()
 
float getX ()
 
float getY ()
 
boolean hasFocus ()
 
boolean isDragging ()
 
boolean isEnabled ()
 
boolean isOpaque ()
 
boolean isVisible ()
 
void keyEvent (KeyEvent e)
 
void mouseEvent (MouseEvent event)
 
void moveTo (float px, float py)
 
void moveTo (float px, float py, GControlMode mode)
 
void post ()
 
void pre ()
 
boolean saveSnapshot ()
 
boolean saveSnapshot (String filename)
 
void setAlpha (int alpha)
 
void setAlpha (int alpha, boolean includeChildren)
 
void setCursorOver (int cursorOver)
 
void setEnabled (boolean enable)
 
void setFocus (boolean focus)
 
void setLocalColor (int colorNo, int color)
 
void setLocalColorScheme (int cs)
 
void setLocalColorScheme (int cs, boolean includeChildren)
 
void setOpaque (boolean opaque)
 
void setRotation (float angle)
 
void setRotation (float angle, GControlMode mode)
 
void setVisible (boolean visible)
 
String toString ()
 

Public Attributes

String tag = ""
 
int tagNo
 
- Public Attributes inherited from g4p_controls.GConstants
int ALPHA_BLOCK = 128
 
int ALPHA_PICK = 48
 
TextAttribute BACKGROUND = TextAttribute.BACKGROUND
 
int BLUE_SCHEME = 6
 
int BOLD = Font.BOLD
 
int CANCEL = JOptionPane.CANCEL_OPTION
 
int CLOSE_WINDOW = 0x00000f02
 
int CLOSED = JOptionPane.CLOSED_OPTION
 
int CTRL_ANGULAR = 0x00000501
 
int CTRL_HORIZONTAL = 0x00000502
 
int CTRL_VERTICAL = 0x00000503
 
int CYAN_SCHEME = 5
 
int DECIMAL = 1
 
char END = java.awt.event.KeyEvent.VK_END
 
int ERROR_MESSAGE = JOptionPane.ERROR_MESSAGE
 
int EXIT_APP = 0x00000f01
 
int EXPONENT = 2
 
TextAttribute FAMILY = TextAttribute.FAMILY
 
TextAttribute FOREGROUND = TextAttribute.FOREGROUND
 
int FORWARD = 1
 
int GOLD_SCHEME = 7
 
int GREEN_SCHEME = 1
 
int HIDE_WINDOW = 0x00000f04
 
char HOME = java.awt.event.KeyEvent.VK_HOME
 
int INFO_MESSAGE = JOptionPane.INFORMATION_MESSAGE
 
int INTEGER = 0
 
int ITALIC = Font.ITALIC
 
int KEEP_OPEN = 0x00000f03
 
int NO = JOptionPane.NO_OPTION
 
int OK = JOptionPane.OK_OPTION
 
int OK_CANCEL = JOptionPane.OK_CANCEL_OPTION
 
int ORANGE_SCHEME = 4
 
int ORIENT_LEFT = -1
 
int ORIENT_RIGHT = 1
 
int ORIENT_TRACK = 0
 
int PLAIN = Font.PLAIN
 
int PLAIN_MESSAGE = JOptionPane.PLAIN_MESSAGE
 
TextAttribute POSTURE = TextAttribute.POSTURE
 
Float POSTURE_OBLIQUE = new Float(0.20f)
 
Float POSTURE_REGULAR = new Float(0.0f)
 
int PURPLE_SCHEME = 3
 
int QUERY_MESSAGE = JOptionPane.QUESTION_MESSAGE
 
int RED_SCHEME = 0
 
int REVERSE = -1
 
int SCHEME_10 = 10
 
int SCHEME_11 = 11
 
int SCHEME_12 = 12
 
int SCHEME_13 = 13
 
int SCHEME_14 = 14
 
int SCHEME_15 = 15
 
int SCHEME_8 = 8
 
int SCHEME_9 = 9
 
int SCROLLBARS_AUTOHIDE = 0x1000
 
int SCROLLBARS_BOTH = 0x0003
 
int SCROLLBARS_HORIZONTAL_ONLY = 0x0002
 
int SCROLLBARS_NONE = 0x0000
 
int SCROLLBARS_VERTICAL_ONLY = 0x0001
 
TextAttribute SIZE = TextAttribute.SIZE
 
TextAttribute STRIKETHROUGH = TextAttribute.STRIKETHROUGH
 
Boolean STRIKETHROUGH_OFF = new Boolean(false)
 
Boolean STRIKETHROUGH_ON = new Boolean(true)
 
TextAttribute SUPERSCRIPT = TextAttribute.SUPERSCRIPT
 
Integer SUPERSCRIPT_OFF = new Integer(0)
 
Integer SUPERSCRIPT_SUB = new Integer(-1)
 
Integer SUPERSCRIPT_SUPER = new Integer(1)
 
int UNDEFINED = Integer.MAX_VALUE
 
int USER_COL_SCHEME = 0x00010102
 
int WARN_MESSAGE = JOptionPane.WARNING_MESSAGE
 
TextAttribute WEIGHT = TextAttribute.WEIGHT
 
Float WEIGHT_BOLD = new Float(2.0f)
 
Float WEIGHT_DEMIBOLD = new Float(1.75f)
 
Float WEIGHT_DEMILIGHT = new Float(0.875f)
 
Float WEIGHT_EXTRA_LIGHT = new Float(0.5f)
 
Float WEIGHT_EXTRABOLD = new Float(2.5f)
 
Float WEIGHT_HEAVY = new Float(2.25f)
 
Float WEIGHT_LIGHT = new Float(0.75f)
 
Float WEIGHT_MEDIUM = new Float(1.5f)
 
Float WEIGHT_REGULAR = new Float(1.0f)
 
Float WEIGHT_SEMIBOLD = new Float(1.25f)
 
Float WEIGHT_ULTRABOLD = new Float(2.75f)
 
TextAttribute WIDTH = TextAttribute.WIDTH
 
Float WIDTH_CONDENSED = new Float(0.75f)
 
Float WIDTH_EXTENDED = new Float(1.5f)
 
Float WIDTH_REGULAR = new Float(1.0f)
 
Float WIDTH_SEMI_CONDENSED = new Float(0.875f)
 
Float WIDTH_SEMI_EXTENDED = new Float(1.25f)
 
int X4 = 1
 
int X8 = 2
 
int YELLOW_SCHEME = 2
 
int YES = JOptionPane.YES_OPTION
 
int YES_NO = JOptionPane.YES_NO_OPTION
 
int YES_NO_CANCEL = JOptionPane.YES_NO_CANCEL_OPTION
 
- Public Attributes inherited from g4p_controls.GConstantsInternal
int ALL_METHOD = 0x0000001f
 
int CLIP_RUN = 512
 
int COMBI_MODES = 768
 
String DEFAULT_SLIDER_STYLE = "grey_blue"
 
int DRAG_CONTROL = 3
 
int DRAW_METHOD = 0x00000001
 
char EOL = '\n'
 
int EXCP_IN_HANDLER = 0xff000005
 
int[][] grid
 
int GROUP_CONTROL_METHOD = DRAW_METHOD | MOUSE_METHOD | KEY_METHOD
 
int I_CL = 4
 
int I_COVERED = 32
 
int I_CR = 8
 
int I_INSIDE = 16
 
int I_MODES = 63
 
int I_NONE = 0
 
int I_TL = 1
 
int I_TR = 2
 
int INVALID_PAPPLET = 0xff000004
 
int INVALID_TYPE = 0xff000003
 
int KEY_METHOD = 0x00000008
 
int MERGE_RUNS = 256
 
int MISSING = 0xff000001
 
int MOUSE_METHOD = 0x00000002
 
int NONEXISTANT = 0xff000002
 
int OFF_CONTROL = 0
 
int OVER_CONTROL = 1
 
BasicStroke pen_1_0 = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)
 
BasicStroke pen_2_0 = new BasicStroke(2, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)
 
BasicStroke pen_3_0 = new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)
 
BasicStroke pen_4_0 = new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)
 
int POST_METHOD = 0x00000010
 
int PRE_METHOD = 0x00000004
 
int PRESS_CONTROL = 2
 
int SCROLLBAR_HORIZONTAL = GConstants.SCROLLBARS_HORIZONTAL_ONLY
 
int SCROLLBAR_VERTICAL = GConstants.SCROLLBARS_VERTICAL_ONLY
 
String SLIDER_STYLES = "|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
 
int TINT_FOR_ALPHA = 255
 
int TPAD2 = 2
 
int TPAD4 = 4
 
int TPAD6 = 6
 
int TPAD8 = 8
 
float WHEEL_DELTA = 0.01f
 
float WHEEL_STICK_FACTOR = 0.51f
 
int Z_PANEL = 1024
 
int Z_SLIPPY = 24
 
int Z_SLIPPY_EXPANDS = 48
 
int Z_STICKY = 0
 

Protected Member Functions

void addToParent (GAbstractControl p)
 
void calcTransformedOrigin (float px, float py)
 
void createEventHandler (Object handlerObj, String methodName, Class[] param_classes, String[] param_names)
 
void fireEvent (Object...objects)
 
int focusObjectZ ()
 
PGraphics getBuffer ()
 
int getCurrHotSpot ()
 
AffineTransform getTransform (AffineTransform aff)
 
boolean isAvailable ()
 
boolean isDisplayable (int ascii)
 
boolean isSuitableForGroupControl (GAbstractControl control)
 
void loseFocus (GAbstractControl grabber)
 
void makeBuffer ()
 
void resize (int w, int h)
 
void setAvailable (boolean avail)
 
void setTextRenderingHints (Graphics2D g2d, int hint)
 
void setZ (int parentZ)
 
void takeFocus ()
 
void updateBuffer ()
 
int whichHotSpot (float px, float py)
 

Protected Attributes

int alphaLevel = G4P.globalAlpha
 
PGraphicsJava2D buffer = null
 
boolean bufferInvalid = true
 
LinkedList< GAbstractControlchildren = null
 
int currSpot = -1
 
int cursorOver = HAND
 
float cx
 
boolean dragging = false
 
Method eventHandlerMethod = null
 
String eventHandlerMethodName
 
Object eventHandlerObject = null
 
float halfWidth
 
HotSpot[] hotspots = null
 
int localColorScheme = G4P.globalColorScheme
 
boolean opaque = false
 
float ox
 
Color[] palette = null
 
GAbstractControl parent = null
 
int registeredMethods = 0
 
float rotAngle
 
double[] temp = new double[2]
 
float width
 
PApplet winApp
 
float x
 
int z = Z_STICKY
 

Static Protected Attributes

static float epsilon = 0.001f
 

Detailed Description

Abstract base class for all GUI controls.

Author
Peter Lager

Constructor & Destructor Documentation

g4p_controls.GAbstractControl.GAbstractControl ( PApplet  theApplet)

Base constructor for ALL control ctors that do not have a visible UI but require access to a PApplet object.
As of V3.5 the only class using this constructor is GGroup

Parameters
theAppletthe main sketch or GWindow control for this control
g4p_controls.GAbstractControl.GAbstractControl ( 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. the size of an image. It will set the position of the control based on controlMode.

Parameters
theAppletthe main sketch or GWindow control for this control
p0x position based on control mode
p1y position based on control mode
g4p_controls.GAbstractControl.GAbstractControl ( PApplet  theApplet,
float  p0,
float  p1,
float  p2,
float  p3 
)

Base constructor for ALL control ctors that have a visible UI. It will set the position and size of the control based on controlMode.

Parameters
theAppletthe main sketch or GWindow control for this control
p0x position based on control mode
p1y position based on control mode
p2x position or width based on control mode
p3y position or height based on control mode

Member Function Documentation

void g4p_controls.GAbstractControl.addControl ( GAbstractControl  c,
float  x,
float  y,
float  angle 
)

This will set the rotation of the control to angle overwriting any previous rotation set. Then it calculates the centre position so that the original top left corner of the control will be the position indicated by x,y with respect to the top left corner of parent.

The added control will have its position calculated relative to the centre of the parent control.

All overloaded methods call this one.

Parameters
cthe control to add.
xthe leftmost or centre position depending on controlMode
ythe topmost or centre position depending on controlMode
anglethe rotation angle (replaces any the angle specified in control)
void g4p_controls.GAbstractControl.addControl ( GAbstractControl  c,
float  x,
float  y 
)

Add a control at the given position with zero rotation angle.

Parameters
cthe control to add.
xthe leftmost or centre position depending on controlMode
ythe topmost or centre position depending on controlMode
void g4p_controls.GAbstractControl.addControl ( GAbstractControl  c)

Add a control at the position and rotation specified in the control.

Parameters
cthe control to add
void g4p_controls.GAbstractControl.addControls ( GAbstractControl...  controls)

Add several control at the position and rotation specified in each control.

Parameters
controlscomma separated list of controls
void g4p_controls.GAbstractControl.addEventHandler ( Object  obj,
String  methodName 
)

Attempt to create the default event handler for the control class. The default event handler is a method that returns void and has a single parameter of the same type as the control class generating the event and a method name specific for that class.

Parameters
objthe object to handle the event
methodNamethe method to execute in the object handler class
void g4p_controls.GAbstractControl.addToParent ( GAbstractControl  p)
protected

Changes that need to be made to child when added. Override where needed e.g. GPanel

Parameters
pthe parent
void g4p_controls.GAbstractControl.calcTransformedOrigin ( float  px,
float  py 
)
protected

This method takes a position px, py and calculates the equivalent position [ox,oy] as if no transformations have taken place and the origin is the top-left corner of the control.

Parameters
px
py
void g4p_controls.GAbstractControl.createEventHandler ( Object  handlerObj,
String  methodName,
Class[]  param_classes,
String[]  param_names 
)
protected

Attempt to create the default event handler for the control class. The default event handler is a method that returns void and has a single parameter of the same type as the control class generating the event and a method name specific for that class.

Parameters
handlerObjthe object to handle the event
methodNamethe method to execute in the object handler class
param_classesthe parameter classes.
param_namesthat names of the parameters (used for error messages only)
void g4p_controls.GAbstractControl.dispose ( )

This will remove all references to this control from G4P after the next frame has been rendered.
The user is responsible for nullifying all references to this control in their sketch code.
Once this method is called the control cannot be reused but resources used by the control remain until ALL references to the control are set to null.
For example if you want to dispose of a button called

btnDoThis

then to remove the button use the statements

btnDoThis.dispose(); 
btnDoThis = null;
void g4p_controls.GAbstractControl.fireEvent ( Object...  objects)
protected

Attempt to fire an event for this control.

The method called must have a single parameter which is the object firing the event. If the method to be called is to have different parameters then it should be overridden in the child class The method

int g4p_controls.GAbstractControl.focusObjectZ ( )
protected

Get the Z order value for the object with focus.
If there is no object with focus or the focus is with a control on another window then return -1 which will allow this control to take focus.

void g4p_controls.GAbstractControl.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. This means that the computationally expensive routines needed to draw the control (especially text controls) are only done when a change has been noted. This means that single changes need not trigger a full redraw to buffer.
It does mean that an error in the library code could result in the buffer not being updated after changes. If this happens then in draw() call this method on the affected control, and report it as an issue here
Thanks

int g4p_controls.GAbstractControl.getAlpha ( )

Returns the current transparency level
0 = fully transparent
255 = opaque

Returns
alpha level
int g4p_controls.GAbstractControl.getCursorOver ( )

Get the shape type when the cursor is over a control

Returns
shape type
float g4p_controls.GAbstractControl.getCX ( )

Get the centre x position of the control.
If the control is on a panel then the value returned is relative to the top-left corner of the panel otherwise it is relative to the sketch window display.

Returns
the x position corresponding to the centre of the control.
float g4p_controls.GAbstractControl.getCY ( )

Get the centre y position of the control.
If the control is on a panel then the value returned is relative to the top-left corner of the panel otherwise it is relative to the sketch window display.

Returns
the y position corresponding to the centre of the control.
float g4p_controls.GAbstractControl.getHeight ( )
Returns
the height
int g4p_controls.GAbstractControl.getLocalColorScheme ( )

Get the local color scheme ID number. If it returns a value <0 then it is using a control specific palette.

Returns
local colour scheme ID
PApplet g4p_controls.GAbstractControl.getPApplet ( )
Returns
the PApplet that manages this control
GAbstractControl g4p_controls.GAbstractControl.getParent ( )

Get the parent control. If null then this is a top-level control

Returns
return parent control, or null if top level
PGraphics g4p_controls.GAbstractControl.getSnapshot ( )

This method should be used sparingly since it is heavy on resources.

Returns
a PGraphics object showing current state of the control (ignoring rotation)
AffineTransform g4p_controls.GAbstractControl.getTransform ( AffineTransform  aff)
protected

Get an affine transformation that is the compound of all transformations including parents

Parameters
aff
float g4p_controls.GAbstractControl.getWidth ( )
Returns
the width
float g4p_controls.GAbstractControl.getX ( )

Get the left position of the control.
If the control is on a panel then the value returned is relative to the top-left corner of the panel otherwise it is relative to the sketch window display.

Returns
top-left corner x position
float g4p_controls.GAbstractControl.getY ( )

Get the top position of the control.
If the control is on a panel then the value returned is relative to the top-left corner of the panel otherwise it is relative to the sketch window display.

Returns
top-left corner y position
boolean g4p_controls.GAbstractControl.hasFocus ( )

Does this control have focus

Returns
true if this control has focus else false
boolean g4p_controls.GAbstractControl.isAvailable ( )
protected

Is this control available?

boolean g4p_controls.GAbstractControl.isDisplayable ( int  ascii)
protected

Support UTF8 encoding

Parameters
asciiUTF8 code
Returns
true if the character can be displayed
boolean g4p_controls.GAbstractControl.isEnabled ( )

Is this control enabled

Returns
true if the control is enabled
boolean g4p_controls.GAbstractControl.isOpaque ( )

Find out if the control is opaque

Returns
true if the background is visible
boolean g4p_controls.GAbstractControl.isSuitableForGroupControl ( GAbstractControl  control)
protected

If the control responds to key or mouse input or has a visual representation this it can be part of a group controller.

Parameters
controlthe G4P control we are interested in
Returns
true if it can be added to a group controller
boolean g4p_controls.GAbstractControl.isVisible ( )
Returns
the control's visibility
void g4p_controls.GAbstractControl.loseFocus ( GAbstractControl  grabber)
protected

For most controls there is nothing to do when they loose focus. Override this method in classes that need to do something when they loose focus eg TextField

void g4p_controls.GAbstractControl.makeBuffer ( )
protected

Make a 2D off-screen buffer for this control.

void g4p_controls.GAbstractControl.moveTo ( float  px,
float  py 
)

Move the control to the given position based on the mode.

The position is not constrained to the screen area.

The current control mode determines whether we move the corner or the center of the control to px,py

Parameters
pxthe horizontal position to move to
pythe vertical position to move to
void g4p_controls.GAbstractControl.moveTo ( float  px,
float  py,
GControlMode  mode 
)

Move the control to the given position based on the mode.

Unlike when dragged the position is not constrained to the screen area.

The mode determines whether we move the corner or the center of the control to px,py

Parameters
pxthe horizontal position to move to
pythe vertical position to move to
modethe control mode
void g4p_controls.GAbstractControl.resize ( int  w,
int  h 
)
protected

Used internally to enforce minimum size constraints

Parameters
wthe new width
hthe new height
boolean g4p_controls.GAbstractControl.saveSnapshot ( )

Save a snapshot of the control using class name and sketch runtime as the filename

Returns
true if the snapshot was saved else return false
boolean g4p_controls.GAbstractControl.saveSnapshot ( String  filename)

Save a snapshot of the control using the specified filename.

Parameters
filenamethe name of the file to save for the image
Returns
true if the snapshot was saved else return false
void g4p_controls.GAbstractControl.setAlpha ( int  alpha)

Set the transparency of the control and make it unavailable to mouse and keyboard events if below the threshold. Child controls are ignored?

Parameters
alphavalue in the range 0 (transparent) to 255 (opaque)
void g4p_controls.GAbstractControl.setAlpha ( int  alpha,
boolean  includeChildren 
)

Set the transparency of the control and make it unavailable to mouse and keyboard events if below the threshold. Child controls are ignored?
If required include the children and their children.

Parameters
alphavalue in the range 0 (transparent) to 255 (opaque)
includeChildrenif do do the same for all descendants
void g4p_controls.GAbstractControl.setAvailable ( boolean  avail)
protected

The availability flag is used by the library code to determine whether a control should be considered for drawing and mouse/key input.
It permits an internal control that does not affect the visible and enabled state of the control, which are set by the programmer.

If a control and its children are made unavailable it will still be drawn but it not respond to user input.

Parameters
avail
void g4p_controls.GAbstractControl.setCursorOver ( int  cursorOver)

Set the shape type to use when the cursor is over a control

Parameters
cursorOverthe shape type to use
void g4p_controls.GAbstractControl.setEnabled ( boolean  enable)

Enable or disable the ability of the control to generate mouse events.
GTextField - it also controls key press events
GPanel - controls whether the panel can be moved/collapsed/expanded

Parameters
enabletrue to enable else false
void g4p_controls.GAbstractControl.setFocus ( boolean  focus)

Determines whether this control is to have focus or not

Parameters
focustrue if the control is to have focus else false.
void g4p_controls.GAbstractControl.setLocalColor ( int  colorNo,
int  color 
)

Change a specific colour within the scheme.
Most controls used a shared colour palette but calling this method will create a new palette specific for this control.

Parameters
colorNothe colour index value (0-15 inlc)
colorARGB color value
void g4p_controls.GAbstractControl.setLocalColorScheme ( int  cs)

Set the local colour scheme for this control. Children are ignored.

Parameters
csthe colour scheme to use (0-15 incl.)
void g4p_controls.GAbstractControl.setLocalColorScheme ( int  cs,
boolean  includeChildren 
)

Set the local colour scheme for this control. If required include the children and their children.

Parameters
csthe colour scheme to use (0-15 incl.)
includeChildrenif do do the same for all descendants
void g4p_controls.GAbstractControl.setOpaque ( boolean  opaque)

Determines whether to show the back colour or not. Only applies to some controls

Parameters
opaquetrue = opaque, flase = transparent
void g4p_controls.GAbstractControl.setRotation ( float  angle)

Set the rotation to apply when displaying this control. The center of rotation is determined by the control_mode attribute.

Parameters
angleclockwise angle in radians
void g4p_controls.GAbstractControl.setRotation ( float  angle,
GControlMode  mode 
)

Set the rotation to apply when displaying this control. The center of rotation is determined by the mode parameter parameter.

Parameters
angleclockwise angle in radians
modePApplet.CORNER / CORNERS / CENTER
void g4p_controls.GAbstractControl.setVisible ( boolean  visible)
Parameters
visiblethe visibility to set
void g4p_controls.GAbstractControl.setZ ( int  parentZ)
protected

Recursive function to set the priority of a control. This is used to determine who gets focus when controls overlap on the screen e.g. when a droplist expands it might cover a button.
It is used where controls have childen e.g. GDropList and GPaneln It is used when a child control is added.

Parameters
control
parentZ
void g4p_controls.GAbstractControl.takeFocus ( )
protected

Give the focus to this control but only after allowing the current control with focus to release it gracefully.
Always cancel the keyFocusIsWith irrespective of the control type. If the control needs to retain keyFocus then override this method in that class e.g. GCombo

int g4p_controls.GAbstractControl.whichHotSpot ( float  px,
float  py 
)
protected

Stop when we are over a hotspot.
Hotspots should be listed in order of importance.

Parameters
px
py
Returns
the index for the first hotspot containing [px,py] else return -1

Member Data Documentation

float g4p_controls.GAbstractControl.cx
protected

The centre of the control

float g4p_controls.GAbstractControl.halfWidth
protected

Half sizes reduces programming complexity later

boolean g4p_controls.GAbstractControl.opaque = false
protected

Whether to show background or not

GAbstractControl g4p_controls.GAbstractControl.parent = null
protected

Link to the parent panel (if null then it is on main window)

float g4p_controls.GAbstractControl.rotAngle
protected

The angle to control is rotated (radians)

String g4p_controls.GAbstractControl.tag = ""

Simple tag that can be used by the user

int g4p_controls.GAbstractControl.tagNo

Allows user to specify a number for this control

double [] g4p_controls.GAbstractControl.temp = new double[2]
protected

Introduced V3 to speed up AffineTransform operations

float g4p_controls.GAbstractControl.width
protected

Width and height of control in pixels for drawing background (changed form int data type in V3

float g4p_controls.GAbstractControl.x
protected

Top left position of control in pixels (relative to parent or absolute if parent is null) (changed form int data type in V3