Drag[en]gine Script Module DragonScript  1.21
Dragengine.Gui.ClickedActionListener Class Reference

Run action if widget is clicked without moving mouse. More...

Inheritance diagram for Dragengine.Gui.ClickedActionListener:
Dragengine.Gui.Events.DefaultMouseListener Dragengine.Gui.Events.MouseListener Dragengine.Gui.EditBindingsListBox.DoubleClickCaptureBinding

Classes

class  ResetMultiClickTimer
 Multi-click reset timer. More...
 

Public Member Functions

int getButton ()
 Mouse button to track. More...
 
int getClickedCount ()
 Count of multi-clicks detected so far. More...
 
int getMultiClickCount ()
 Count of multi clicks before fire action. More...
 
float getMultiClickTimeout ()
 Maximum time in seconds between clicks to count as multi-click. More...
 
Point getPosition ()
 Mouse position at button press time or null if not tracked. More...
 
int getRange ()
 Range in pixels the mouse is allowed to move to fire the action. More...
 
ClickedActionListener new ()
 Create mouse listener tracking left mouse button and range of 5 pixels. More...
 
ClickedActionListener new (int trackButton, int range)
 Create mouse listener. More...
 
void onAction ()
 Action to perform. More...
 
void onButtonPress (MouseEvent event)
 Mouse button pressed. More...
 
void onButtonRelease (MouseEvent event)
 Mouse button release. More...
 
void onMouseMove (MouseEvent event)
 Mouse moved. More...
 
void resetMultiClickDetection ()
 Reset multi click detection. More...
 
void setMultiClickCount (int count)
 Set count of multi clicks before fire action. More...
 
void setMultiClickTimeout (float time)
 Set maximum time in seconds between clicks to count as multi-click. More...
 
- Public Member Functions inherited from Dragengine.Gui.Events.DefaultMouseListener
void onMouseEnter (MouseEvent event)
 Mouse has entered widget. More...
 
void onMouseLeave (MouseEvent event)
 Mouse has left widget. More...
 
void onMouseWheel (MouseEvent event)
 Mouse wheel moved. More...
 

Protected Member Functions

void setPosition (Point position)
 Set mouse position at button press time or null if not tracked. More...
 

Detailed Description

Run action if widget is clicked without moving mouse.

Useful for situations where an action should be triggered if a widget is clicked upon which does not provide this kind of interaction. This listener does not capture the mouse like for example Button does. This allows other mouse listeners to apply to the widget while this listener tracks the press and release button action. While the button is pressed the mouse movement relative to the parent desktop is tracked. If the mouse moves outside a given range the tracking is interrupted. Once the button is released the action is triggered but tracking has not been interrupted.

Version 1.7

Multi-click can be detected by setting the required amount of clicks to detect using setMultiClickCount(). The default time between multi clicks is 0.4s and can be set using setMultiClickTimeout(). Successful multi click is detected if all required clicks occure at most getMultiClickTimeout() seconds apart and are located at most getRange() compared to the position of the first click.

Member Function Documentation

◆ getButton()

int Dragengine.Gui.ClickedActionListener.getButton ( )

Mouse button to track.

◆ getClickedCount()

int Dragengine.Gui.ClickedActionListener.getClickedCount ( )

Count of multi-clicks detected so far.

Version
1.7

◆ getMultiClickCount()

int Dragengine.Gui.ClickedActionListener.getMultiClickCount ( )

Count of multi clicks before fire action.

Version
1.7

◆ getMultiClickTimeout()

float Dragengine.Gui.ClickedActionListener.getMultiClickTimeout ( )

Maximum time in seconds between clicks to count as multi-click.

Version
1.7

◆ getPosition()

Point Dragengine.Gui.ClickedActionListener.getPosition ( )

Mouse position at button press time or null if not tracked.

◆ getRange()

int Dragengine.Gui.ClickedActionListener.getRange ( )

Range in pixels the mouse is allowed to move to fire the action.

◆ new() [1/2]

ClickedActionListener Dragengine.Gui.ClickedActionListener.new ( )

Create mouse listener tracking left mouse button and range of 5 pixels.

Reimplemented from Dragengine.Gui.Events.DefaultMouseListener.

◆ new() [2/2]

ClickedActionListener Dragengine.Gui.ClickedActionListener.new ( int  trackButton,
int  range 
)

Create mouse listener.

Parameters
trackButtonValue from InputEventMouseButton or custom.
rangeRange in pixels the mouse is allowed to move to fire the action.
Exceptions
EInvalidParamrange is less than 0.

◆ onAction()

void Dragengine.Gui.ClickedActionListener.onAction ( )

◆ onButtonPress()

void Dragengine.Gui.ClickedActionListener.onButtonPress ( MouseEvent  event)

Mouse button pressed.

Starts tracking if button matches the track button

Reimplemented from Dragengine.Gui.Events.DefaultMouseListener.

◆ onButtonRelease()

void Dragengine.Gui.ClickedActionListener.onButtonRelease ( MouseEvent  event)

Mouse button release.

If button matches tracking button and tracking is active perform action.

Reimplemented from Dragengine.Gui.Events.DefaultMouseListener.

◆ onMouseMove()

void Dragengine.Gui.ClickedActionListener.onMouseMove ( MouseEvent  event)

Mouse moved.

Check track position and disable tracking if moved outside range.

Reimplemented from Dragengine.Gui.Events.DefaultMouseListener.

◆ resetMultiClickDetection()

void Dragengine.Gui.ClickedActionListener.resetMultiClickDetection ( )

Reset multi click detection.

Version
1.7

Called by internal multi-click reset timer.

◆ setMultiClickCount()

void Dragengine.Gui.ClickedActionListener.setMultiClickCount ( int  count)

Set count of multi clicks before fire action.

Version
1.7
Exceptions
EInvalidParamcount is less than 1

◆ setMultiClickTimeout()

void Dragengine.Gui.ClickedActionListener.setMultiClickTimeout ( float  time)

Set maximum time in seconds between clicks to count as multi-click.

Version
1.7

◆ setPosition()

void Dragengine.Gui.ClickedActionListener.setPosition ( Point  position)
protected

Set mouse position at button press time or null if not tracked.


The documentation for this class was generated from the following file: