G4P (GUI for Processing) 4.3.11
A set of GUI controls for your Processing sketch.
Loading...
Searching...
No Matches
g4p_controls.GAbstractControl Class Referenceabstract
Inheritance diagram for g4p_controls.GAbstractControl:

Classes

class  Z_Order
 

Public Member Functions

void addControl (GAbstractControl c)
 
void addControl (GAbstractControl c, float x, float y)
 
void addControl (GAbstractControl c, float x, float y, float angle)
 
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 ()
 
float getRotation ()
 
PGraphics getSnapshot ()
 
GToolTip getTip ()
 
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 ()
 
void removeTip ()
 
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 setTip (GToolTip tt, float offset, float angle)
 
void setTip (GToolTip tt, GAlign ax, GAlign ay, float gap)
 
void setTip (String text, float offset, float angle)
 
void setTip (String text, GAlign ax, GAlign ay, float gap)
 
void setTipDisplayTime (long msecs)
 
void setTipEnabled (boolean enable)
 
void setTipHorz (boolean level)
 
void setTipPos (float radius, float ang)
 
void setTipPos (GAlign ax, GAlign ay, float gap)
 
void setTipText (String text)
 
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
 
TextAttribute UNDERLINE = TextAttribute.UNDERLINE
 
int UNDERLINE_OFF = Integer.valueOf(-1)
 
int UNDERLINE_ON = TextAttribute.UNDERLINE_ON
 
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
 

Protected Member Functions

void addControlImpl (GAbstractControl c, float x, float y, float angle)
 
void addToParent (GAbstractControl p)
 
void calcTransformedOrigin (float px, float py)
 
boolean controlSupportsToolTips ()
 
void createEventHandler (Object handlerObj, String methodName, Class[] param_classes, String[] param_names)
 
void drawChildren ()
 
void fireEvent (Object... objects)
 
int focusObjectZ ()
 
PGraphics getBuffer ()
 
int getCurrHotSpot ()
 
AffineTransform getTransform (AffineTransform aff)
 
void hideTip ()
 
boolean isAvailable ()
 
boolean isDisplayable (int ascii)
 
boolean isSuitableForGroupControl (GAbstractControl control)
 
void loseFocus (GAbstractControl grabber)
 
void makeBuffer ()
 
void manageToolTip ()
 
void resize (int w, int h)
 
void resize (int w, int h, GControlMode mode)
 
void setAvailable (boolean avail)
 
void setZ (int parentZ)
 
void showTip ()
 
void takeFocus ()
 
void updateBuffer ()
 
int whichHotSpot (float px, float py)
 

Protected Attributes

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

Static Protected Attributes

static GAbstractControl controlToTakeFocus = null
 
static GAbstractControl cursorIsOver
 
static float epsilon = 0.001f
 
static GAbstractControl focusIsWith = null
 

Detailed Description

Abstract base class for all GUI controls.

Author
Peter Lager

Constructor & Destructor Documentation

◆ GAbstractControl() [1/3]

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

◆ GAbstractControl() [2/3]

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

◆ GAbstractControl() [3/3]

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

◆ addControl() [1/3]

void g4p_controls.GAbstractControl.addControl ( GAbstractControl  c)

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

Parameters
cthe control to add

Reimplemented in g4p_controls.GControlPalette, and g4p_controls.GGroup.

◆ addControl() [2/3]

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

Reimplemented in g4p_controls.GControlPalette.

◆ addControl() [3/3]

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)

Reimplemented in g4p_controls.GControlPalette, and g4p_controls.GPanel.

◆ addControlImpl()

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

All addControl(...) methods must call this one.

Checks to see if this control allows children and creates the child list if needed.

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)

◆ addControls()

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

Reimplemented in g4p_controls.GControlPalette, and g4p_controls.GGroup.

◆ addEventHandler()

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

◆ addToParent()

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

Reimplemented in g4p_controls.GPanel.

◆ calcTransformedOrigin()

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

◆ controlSupportsToolTips()

boolean g4p_controls.GAbstractControl.controlSupportsToolTips ( )
protected

Return true if this class / control supports tool tips otherwise false and output error message.

◆ createEventHandler()

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)

◆ dispose()

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;

Reimplemented in g4p_controls.GEditableTextControl.

◆ draw()

void g4p_controls.GAbstractControl.draw ( )

◆ drawChildren()

void g4p_controls.GAbstractControl.drawChildren ( )
protected

Introduced in V4.3.9 along with tool tips

◆ fireEvent()

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

◆ focusObjectZ()

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.

◆ forceBufferUpdate()

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

Reimplemented in g4p_controls.GTextBase.

◆ getAlpha()

int g4p_controls.GAbstractControl.getAlpha ( )

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

Returns
alpha level

◆ getCursorOver()

int g4p_controls.GAbstractControl.getCursorOver ( )

Get the shape type when the cursor is over a control

Returns
shape type

◆ getCX()

float g4p_controls.GAbstractControl.getCX ( )

Get the centre x position of the control centre.

Changed 3.4.10

Returns
the x position corresponding to the centre of the control.

◆ getCY()

float g4p_controls.GAbstractControl.getCY ( )

Get the centre y position of the control centre.

Changed 3.4.10

Returns
the y position corresponding to the centre of the control.

◆ getHeight()

float g4p_controls.GAbstractControl.getHeight ( )
Returns
the height

◆ getLocalColorScheme()

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

◆ getPApplet()

PApplet g4p_controls.GAbstractControl.getPApplet ( )
Returns
the PApplet that manages this control

◆ getParent()

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

◆ getRotation()

float g4p_controls.GAbstractControl.getRotation ( )
Returns
the rotation

◆ getSnapshot()

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)

Reimplemented in g4p_controls.GAbstractView, g4p_controls.GDropList, g4p_controls.GPassword, g4p_controls.GSpinner, g4p_controls.GTextArea, and g4p_controls.GTextField.

◆ getTip()

GToolTip g4p_controls.GAbstractControl.getTip ( )

Gets a reference to the tool tip so the user can access methods not available through its control.

Returns
the tool tip

◆ getTransform()

AffineTransform g4p_controls.GAbstractControl.getTransform ( AffineTransform  aff)
protected

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

Parameters
aff

◆ getWidth()

float g4p_controls.GAbstractControl.getWidth ( )
Returns
the width

◆ getX()

float g4p_controls.GAbstractControl.getX ( )

Get the top-left x position of the control.

Changed 3.4.10

Returns
top-left corner x position

◆ getY()

float g4p_controls.GAbstractControl.getY ( )

Get the top-left y position of the control.

Changed 3.4.10

Returns
top-left corner y position

◆ hasFocus()

boolean g4p_controls.GAbstractControl.hasFocus ( )

Does this control have focus

Returns
true if this control has focus else false

◆ hideTip()

void g4p_controls.GAbstractControl.hideTip ( )
protected

Hide the tool tip. Called when mouse exits control or display time exceeded.

◆ isAvailable()

boolean g4p_controls.GAbstractControl.isAvailable ( )
protected

Is this control available?

◆ isDisplayable()

boolean g4p_controls.GAbstractControl.isDisplayable ( int  ascii)
protected

Support UTF8 encoding

Parameters
asciiUTF8 code
Returns
true if the character can be displayed

◆ isEnabled()

boolean g4p_controls.GAbstractControl.isEnabled ( )

Is this control enabled

Returns
true if the control is enabled

◆ isOpaque()

boolean g4p_controls.GAbstractControl.isOpaque ( )

Find out if the control is opaque

Returns
true if the background is visible

◆ isSuitableForGroupControl()

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

◆ isVisible()

boolean g4p_controls.GAbstractControl.isVisible ( )
Returns
the control's visibility

◆ loseFocus()

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

Reimplemented in g4p_controls.GDropList, g4p_controls.GEditableTextControl, g4p_controls.GPanel, g4p_controls.GPassword, and g4p_controls.GSpinner.

◆ makeBuffer()

void g4p_controls.GAbstractControl.makeBuffer ( )
protected

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

◆ manageToolTip()

void g4p_controls.GAbstractControl.manageToolTip ( )
protected

Used internally at runtime to show/hide the tool tip. V4.3.9

◆ mouseEvent()

◆ moveTo() [1/2]

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

Reimplemented in g4p_controls.GViewPeasyCam.

◆ moveTo() [2/2]

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

Reimplemented in g4p_controls.GViewPeasyCam.

◆ pre()

void g4p_controls.GAbstractControl.pre ( )

◆ removeTip()

void g4p_controls.GAbstractControl.removeTip ( )

Removes the existing tool tip for this control.

◆ resize() [1/2]

void g4p_controls.GAbstractControl.resize ( int  w,
int  h 
)
protected

Used internally to enforce minimum size constraints using current global control mode.

This updates x, y, cx, cy, width and height so the original and resized control have the same centre position.

Parameters
w
h

◆ resize() [2/2]

void g4p_controls.GAbstractControl.resize ( int  w,
int  h,
GControlMode  mode 
)
protected

Used internally to enforce minimum size constraints using user defined control mode.

This updates x, y, cx, cy, width and height so the original and resized control have the same centre position.

Parameters
wthe new width
hthe new height

◆ saveSnapshot() [1/2]

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

◆ saveSnapshot() [2/2]

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

Reimplemented in g4p_controls.GAbstractView.

◆ setAlpha() [1/2]

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)

Reimplemented in g4p_controls.GGroup, and g4p_controls.GViewPeasyCam.

◆ setAlpha() [2/2]

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

Reimplemented in g4p_controls.GGroup, and g4p_controls.GViewPeasyCam.

◆ setAvailable()

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

◆ setCursorOver()

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

◆ setEnabled()

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

Reimplemented in g4p_controls.GButton, g4p_controls.GGroup, g4p_controls.GImageButton, g4p_controls.GSlider, and g4p_controls.GViewPeasyCam.

◆ setFocus()

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.

Reimplemented in g4p_controls.GEditableTextControl, and g4p_controls.GPassword.

◆ setLocalColor()

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

◆ setLocalColorScheme() [1/2]

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.)

Reimplemented in g4p_controls.GGroup, g4p_controls.GDropList, g4p_controls.GEditableTextControl, and g4p_controls.GPassword.

◆ setLocalColorScheme() [2/2]

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

◆ setOpaque()

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

Reimplemented in g4p_controls.GPanel.

◆ setRotation() [1/2]

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

Reimplemented in g4p_controls.GViewPeasyCam.

◆ setRotation() [2/2]

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

Reimplemented in g4p_controls.GToolTip, and g4p_controls.GViewPeasyCam.

◆ setTip() [1/4]

void g4p_controls.GAbstractControl.setTip ( GToolTip  tt,
float  offset,
float  angle 
)

Only use this method if you are creating custom tool tips.

Replaces the current tool tip (if any) with a new tool tip for this control. Do not use this method to simply change the tip text, in that situation use the setToolTipText(String) method.

Parameters
ttthe custom tool tip
offsetdistance between control and tool tip centres
anglethe angle (radians) made by the line joining the control centre the tool tip centre

◆ setTip() [2/4]

void g4p_controls.GAbstractControl.setTip ( GToolTip  tt,
GAlign  ax,
GAlign  ay,
float  gap 
)

Only use this method if you are creating custom tool tips.

Replaces the current tool tip (if any) with a new tool tip for this control. Do not use this method to simply change the tip text, in that situation use the setTipText(String) method.

Parameters
ttthe custom tool tip
axhorizontal alignment with its control (LEFT, CENTER, RIGHT)
ayvertical position relative with its control (NORTH, SOUTH)
gapthe gap between the tool tip and its control in pixels

◆ setTip() [3/4]

void g4p_controls.GAbstractControl.setTip ( String  text,
float  offset,
float  angle 
)

Replaces the current tool tip (if any) with a new tool tip for this control. Do not use this method to simply change the tip text, in that situation use the setToolTipText(String) method.

Parameters
textthe text to display
offsetdistance between control and tool tip centres
anglethe angle (radians) made by the line joining the control centre the tool tip centre

◆ setTip() [4/4]

void g4p_controls.GAbstractControl.setTip ( String  text,
GAlign  ax,
GAlign  ay,
float  gap 
)

Replaces the current tool tip (if any) with a new tool tip for this control. Do not use this method to simply change the tip text, in that situation use the setTipText(String) method.

Parameters
textthe text to display
axhorizontal alignment with its control (LEFT, CENTER, RIGHT)
ayvertical position relative with its control (NORTH, SOUTH)
gapthe gap between the tool tip and its control in pixels

◆ setTipDisplayTime()

void g4p_controls.GAbstractControl.setTipDisplayTime ( long  msecs)

Set the maximum length of time to show the tool tip

Parameters
msecs

◆ setTipEnabled()

void g4p_controls.GAbstractControl.setTipEnabled ( boolean  enable)

If this control has a tool tip set its enabled state.

Parameters
enabletrue to show tips, false to hide tips

◆ setTipHorz()

void g4p_controls.GAbstractControl.setTipHorz ( boolean  level)

By default the tool tip is always aligned along the X axis. To have the tool tip rotate with the control pass false.

Parameters
levelfalse to rotate with the control else false to keep horizontal

◆ setTipPos() [1/2]

void g4p_controls.GAbstractControl.setTipPos ( float  radius,
float  ang 
)

Implementation method to set a tool tip based on polar position (offset and angle)

◆ setTipPos() [2/2]

void g4p_controls.GAbstractControl.setTipPos ( GAlign  ax,
GAlign  ay,
float  gap 
)

Implementation method to set a tool tip based on alignment with control

◆ setTipText()

void g4p_controls.GAbstractControl.setTipText ( String  text)

If this control has a tool tip change the text it displays.

Parameters
textthe text to display

◆ setVisible()

void g4p_controls.GAbstractControl.setVisible ( boolean  visible)
Parameters
visiblethe visibility to set

Reimplemented in g4p_controls.GGroup.

◆ setZ()

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

◆ showTip()

void g4p_controls.GAbstractControl.showTip ( )
protected

Show the tool tip. Called when mouse enters control.

◆ takeFocus()

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

Reimplemented in g4p_controls.GEditableTextControl, and g4p_controls.GPassword.

◆ updateBuffer()

void g4p_controls.GAbstractControl.updateBuffer ( )
protected

◆ whichHotSpot()

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

◆ cx

float g4p_controls.GAbstractControl.cx
protected

The centre of the control

◆ halfWidth

float g4p_controls.GAbstractControl.halfWidth
protected

Half sizes reduces programming complexity later

◆ height

float g4p_controls.GAbstractControl.height
protected

Reimplemented in g4p_controls.GAbstractView.

◆ opaque

boolean g4p_controls.GAbstractControl.opaque = false
protected

Whether to show background or not

◆ parent

GAbstractControl g4p_controls.GAbstractControl.parent = null
protected

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

◆ rotAngle

float g4p_controls.GAbstractControl.rotAngle
protected

The angle to control is rotated (radians)

◆ tag

String g4p_controls.GAbstractControl.tag = ""

Simple tag that can be used by the user

◆ tagNo

int g4p_controls.GAbstractControl.tagNo

Allows user to specify a number for this control

◆ temp

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

Introduced V3 to speed up AffineTransform operations

◆ width

float g4p_controls.GAbstractControl.width
protected

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

Reimplemented in g4p_controls.GAbstractView.

◆ x

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

Reimplemented in g4p_controls.GAbstractView.

◆ y

float g4p_controls.GAbstractControl.y
protected

Reimplemented in g4p_controls.GAbstractView.