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

Public Member Functions

final int button ()
 
final int count ()
 
final MouseEvent getEvent ()
 
final int getFlavor ()
 
final PGraphics getGraphics ()
 
final int getModifiers ()
 
final Object getNative ()
 
final PApplet getPApplet ()
 
final int height ()
 
final void invalidate ()
 
final boolean is3D ()
 
final boolean isAltDown ()
 
final boolean isControlDown ()
 
final boolean isMetaDown ()
 
final boolean isMouseOver ()
 
final boolean isMousePressed ()
 
final boolean isShiftDown ()
 
void mouseClicked ()
 
void mouseDragged ()
 
void mouseEntered ()
 
void mouseEvent (MouseEvent event)
 
void mouseExited ()
 
void mouseMoved ()
 
void mousePressed ()
 
void mouseReleased ()
 
void mouseWheel (MouseEvent event)
 
final int mouseX ()
 
final int mouseY ()
 
final int pmouseX ()
 
final int pmouseY ()
 
void update ()
 
final void validate ()
 
final float wheelSensitivity ()
 
final void wheelSensitivity (float sensitivity)
 
final int width ()
 

Protected Member Functions

void setView (GAbstractView view)
 

Protected Attributes

GAbstractView gview = null
 
float wheel_sensitivity = 1
 

Detailed Description

This class provides all the key methods needed to respond to mouse events from a GView controlled and render the view.

The user should create their own class that inherits from this class and override the update() method and any of the mouse???() methods they want to use.

Author
Peter Lager

Member Function Documentation

final int g4p_controls.GViewListener.button ( )
Returns
the mouse button
final int g4p_controls.GViewListener.count ( )

Get the raw count value returned by the mouse wheel.
You would need to scale this for your mouse by multiplying by the wheel sensitivity.

Returns
the count for the mouse wheel
final MouseEvent g4p_controls.GViewListener.getEvent ( )

Use this to get the last event processed. Useful for those methods not included in this class.

Returns
the mouse event
final int g4p_controls.GViewListener.getFlavor ( )
Returns
the event flavor. It is always Event.MOUSE
final PGraphics g4p_controls.GViewListener.getGraphics ( )

Get the PGrahics canvas for this viewer. The returned value should be cast to Graphics3D is view is 3D (i.e. uses P3D)

Returns
the graphics context
final int g4p_controls.GViewListener.getModifiers ( )
Returns
the modifier keys
final Object g4p_controls.GViewListener.getNative ( )

Get the platform-native event object. This might be the java.awt event on the desktop, though if you're using OpenGL on the desktop it'll be a NEWT event that JOGL uses. Android events are something else altogether. Bottom line, use this only if you know what you're doing, and don't make assumptions about the class type.

Returns
the platform-native event object.
final PApplet g4p_controls.GViewListener.getPApplet ( )

Get the PApplet used to create the view.

Returns
the PApplet container for the view
final int g4p_controls.GViewListener.height ( )
Returns
the height of the view
final void g4p_controls.GViewListener.invalidate ( )

This method will cause the update() method to be executed at the next frame.

final boolean g4p_controls.GViewListener.is3D ( )
Returns
true if view is 3D (i.e. uses P3D)
final boolean g4p_controls.GViewListener.isAltDown ( )
Returns
true if the alt key is down else fals
final boolean g4p_controls.GViewListener.isControlDown ( )
Returns
true if the ctrl key is down else fals
final boolean g4p_controls.GViewListener.isMetaDown ( )
Returns
true if the meta key is down else fals
final boolean g4p_controls.GViewListener.isMouseOver ( )
Returns
true if the mouse is over the view area?
final boolean g4p_controls.GViewListener.isMousePressed ( )
Returns
true if a mouse button is being pressed?
final boolean g4p_controls.GViewListener.isShiftDown ( )
Returns
true if the shift key is down else false
void g4p_controls.GViewListener.mouseClicked ( )

This method should be overridden in the child class

void g4p_controls.GViewListener.mouseDragged ( )

This method should be overridden in the child class

void g4p_controls.GViewListener.mouseEntered ( )

This method should be overridden in the child class

void g4p_controls.GViewListener.mouseEvent ( MouseEvent  event)

This method should be overridden in the child class

Parameters
eventthe mouse event corrected for the associated view position
void g4p_controls.GViewListener.mouseExited ( )

This method should be overridden in the child class

void g4p_controls.GViewListener.mouseMoved ( )

This method should be overridden in the child class

void g4p_controls.GViewListener.mousePressed ( )

This method should be overridden in the child class

void g4p_controls.GViewListener.mouseReleased ( )

This method should be overridden in the child class

void g4p_controls.GViewListener.mouseWheel ( MouseEvent  event)

This method should be overridden in the child class

final int g4p_controls.GViewListener.mouseX ( )
Returns
the mouse X position for the current event
final int g4p_controls.GViewListener.mouseY ( )
Returns
the mouse Y position for the current event
final int g4p_controls.GViewListener.pmouseX ( )
Returns
the mouse X position for the previous event
final int g4p_controls.GViewListener.pmouseY ( )
Returns
the mouse Y position for the previous event
void g4p_controls.GViewListener.setView ( GAbstractView  view)
protected

This method is called by the GView control when this listener is added to it.

Parameters
viewthe GView this listener is for.
void g4p_controls.GViewListener.update ( )

This method should be overridden in the child class

final void g4p_controls.GViewListener.validate ( )

This method will stop the update() method being executed until the next call to invalidate().

final float g4p_controls.GViewListener.wheelSensitivity ( )

Get the mouse wheel sensitivity for this listener

Returns
the wheel sensitivity
final void g4p_controls.GViewListener.wheelSensitivity ( float  sensitivity)

Set the mouse wheel sensitivity for this listener

Parameters
sensitivitythe wheel sensitivity to use
final int g4p_controls.GViewListener.width ( )
Returns
the width of the view