G4P (GUI for Processing) 4.3.9
A set of GUI controls for your Processing sketch.
Loading...
Searching...
No Matches
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

◆ button()

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

◆ count()

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

◆ getEvent()

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

◆ getFlavor()

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

◆ getGraphics()

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

◆ getModifiers()

final int g4p_controls.GViewListener.getModifiers ( )
Returns
the modifier keys

◆ getNative()

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.

◆ getPApplet()

final PApplet g4p_controls.GViewListener.getPApplet ( )

Get the PApplet used to create the view.

Returns
the PApplet container for the view

◆ height()

final int g4p_controls.GViewListener.height ( )
Returns
the height of the view

◆ invalidate()

final void g4p_controls.GViewListener.invalidate ( )

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

◆ is3D()

final boolean g4p_controls.GViewListener.is3D ( )
Returns
true if view is 3D (i.e. uses P3D)

◆ isAltDown()

final boolean g4p_controls.GViewListener.isAltDown ( )
Returns
true if the alt key is down else fals

◆ isControlDown()

final boolean g4p_controls.GViewListener.isControlDown ( )
Returns
true if the ctrl key is down else fals

◆ isMetaDown()

final boolean g4p_controls.GViewListener.isMetaDown ( )
Returns
true if the meta key is down else fals

◆ isMouseOver()

final boolean g4p_controls.GViewListener.isMouseOver ( )
Returns
true if the mouse is over the view area?

◆ isMousePressed()

final boolean g4p_controls.GViewListener.isMousePressed ( )
Returns
true if a mouse button is being pressed?

◆ isShiftDown()

final boolean g4p_controls.GViewListener.isShiftDown ( )
Returns
true if the shift key is down else false

◆ mouseClicked()

void g4p_controls.GViewListener.mouseClicked ( )

This method should be overridden in the child class

◆ mouseDragged()

void g4p_controls.GViewListener.mouseDragged ( )

This method should be overridden in the child class

◆ mouseEntered()

void g4p_controls.GViewListener.mouseEntered ( )

This method should be overridden in the child class

◆ mouseEvent()

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

◆ mouseExited()

void g4p_controls.GViewListener.mouseExited ( )

This method should be overridden in the child class

◆ mouseMoved()

void g4p_controls.GViewListener.mouseMoved ( )

This method should be overridden in the child class

◆ mousePressed()

void g4p_controls.GViewListener.mousePressed ( )

This method should be overridden in the child class

◆ mouseReleased()

void g4p_controls.GViewListener.mouseReleased ( )

This method should be overridden in the child class

◆ mouseWheel()

void g4p_controls.GViewListener.mouseWheel ( MouseEvent  event)

This method should be overridden in the child class

◆ mouseX()

final int g4p_controls.GViewListener.mouseX ( )
Returns
the mouse X position for the current event

◆ mouseY()

final int g4p_controls.GViewListener.mouseY ( )
Returns
the mouse Y position for the current event

◆ pmouseX()

final int g4p_controls.GViewListener.pmouseX ( )
Returns
the mouse X position for the previous event

◆ pmouseY()

final int g4p_controls.GViewListener.pmouseY ( )
Returns
the mouse Y position for the previous event

◆ setView()

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.

◆ update()

void g4p_controls.GViewListener.update ( )

This method should be overridden in the child class

◆ validate()

final void g4p_controls.GViewListener.validate ( )

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

◆ wheelSensitivity() [1/2]

final float g4p_controls.GViewListener.wheelSensitivity ( )

Get the mouse wheel sensitivity for this listener

Returns
the wheel sensitivity

◆ wheelSensitivity() [2/2]

final void g4p_controls.GViewListener.wheelSensitivity ( float  sensitivity)

Set the mouse wheel sensitivity for this listener

Parameters
sensitivitythe wheel sensitivity to use

◆ width()

final int g4p_controls.GViewListener.width ( )
Returns
the width of the view