Drag[en]gine Script Module DragonScript
1.23
|
Run action if widget is clicked without moving mouse. More...
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... | |
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.
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.
int Dragengine.Gui.ClickedActionListener.getButton | ( | ) |
Mouse button to track.
int Dragengine.Gui.ClickedActionListener.getClickedCount | ( | ) |
Count of multi-clicks detected so far.
int Dragengine.Gui.ClickedActionListener.getMultiClickCount | ( | ) |
Count of multi clicks before fire action.
float Dragengine.Gui.ClickedActionListener.getMultiClickTimeout | ( | ) |
Maximum time in seconds between clicks to count as multi-click.
Point Dragengine.Gui.ClickedActionListener.getPosition | ( | ) |
Mouse position at button press time or null if not tracked.
int Dragengine.Gui.ClickedActionListener.getRange | ( | ) |
Range in pixels the mouse is allowed to move to fire the action.
ClickedActionListener Dragengine.Gui.ClickedActionListener.new | ( | ) |
Create mouse listener tracking left mouse button and range of 5 pixels.
Reimplemented from Dragengine.Gui.Events.DefaultMouseListener.
ClickedActionListener Dragengine.Gui.ClickedActionListener.new | ( | int | trackButton, |
int | range | ||
) |
Create mouse listener.
trackButton | Value from InputEventMouseButton or custom. |
range | Range in pixels the mouse is allowed to move to fire the action. |
EInvalidParam | range is less than 0. |
void Dragengine.Gui.ClickedActionListener.onAction | ( | ) |
Action to perform.
If you need to know the mouse location at the time of the click use Widget.getLocalMouseLocation() on the desired widget. You can not use getPosition() for this since this position is relative to whatever widget caused the mouse events to be send and it is cleared before calling onAction.
Reimplemented in Dragengine.Gui.ModManagement.MMPanelModUserAccount.ClickedOpenProfileUrl, Dragengine.Gui.ModManagement.MMPanelModManagement.ClickedModDetails, Dragengine.Gui.ModManagement.MMImageGallery.ClickShowGalleryImage, Dragengine.Gui.ClickedOpenLink, and Dragengine.Gui.EditBindingsListBox.DoubleClickCaptureBinding.
void Dragengine.Gui.ClickedActionListener.onButtonPress | ( | MouseEvent | event | ) |
Mouse button pressed.
Starts tracking if button matches the track button
Reimplemented from Dragengine.Gui.Events.DefaultMouseListener.
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.
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.
void Dragengine.Gui.ClickedActionListener.resetMultiClickDetection | ( | ) |
Reset multi click detection.
Called by internal multi-click reset timer.
void Dragengine.Gui.ClickedActionListener.setMultiClickCount | ( | int | count | ) |
Set count of multi clicks before fire action.
EInvalidParam | count is less than 1 |
void Dragengine.Gui.ClickedActionListener.setMultiClickTimeout | ( | float | time | ) |
Set maximum time in seconds between clicks to count as multi-click.
|
protected |
Set mouse position at button press time or null if not tracked.