|
JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins
« « « Anklang Documentation |
Contains position and status information about a mouse event. More...
#include "juce_MouseEvent.h"
Public Member Functions | |
| MouseEvent (MouseInputSource source, Point< float > position, ModifierKeys modifiers, float pressure, float orientation, float rotation, float tiltX, float tiltY, Component *eventComponent, Component *originator, Time eventTime, Point< float > mouseDownPos, Time mouseDownTime, int numberOfClicks, bool mouseWasDragged) noexcept | |
| Creates a MouseEvent. | |
| MouseEvent (const MouseEvent &)=default | |
| MouseEvent & | operator= (const MouseEvent &)=delete |
| MouseEvent (MouseEvent &&)=default | |
| MouseEvent & | operator= (MouseEvent &&)=delete |
| int | getMouseDownX () const noexcept |
| Returns the x coordinate of the last place that a mouse was pressed. | |
| int | getMouseDownY () const noexcept |
| Returns the y coordinate of the last place that a mouse was pressed. | |
| Point< int > | getMouseDownPosition () const noexcept |
| Returns the coordinates of the last place that a mouse was pressed. | |
| int | getDistanceFromDragStart () const noexcept |
| Returns the straight-line distance between where the mouse is now and where it was the last time the button was pressed. | |
| int | getDistanceFromDragStartX () const noexcept |
| Returns the difference between the mouse's current x position and where it was when the button was last pressed. | |
| int | getDistanceFromDragStartY () const noexcept |
| Returns the difference between the mouse's current y position and where it was when the button was last pressed. | |
| Point< int > | getOffsetFromDragStart () const noexcept |
| Returns the difference between the mouse's current position and where it was when the button was last pressed. | |
| bool | mouseWasDraggedSinceMouseDown () const noexcept |
| Returns true if the user seems to be performing a drag gesture. | |
| bool | mouseWasClicked () const noexcept |
| Returns true if the mouse event is part of a click gesture rather than a drag. | |
| int | getNumberOfClicks () const noexcept |
| For a click event, the number of times the mouse was clicked in succession. | |
| int | getLengthOfMousePress () const noexcept |
| Returns the time that the mouse button has been held down for. | |
| bool | isPressureValid () const noexcept |
| Returns true if the pressure value for this event is meaningful. | |
| bool | isOrientationValid () const noexcept |
| Returns true if the orientation value for this event is meaningful. | |
| bool | isRotationValid () const noexcept |
| Returns true if the rotation value for this event is meaningful. | |
| bool | isTiltValid (bool tiltX) const noexcept |
| Returns true if the current tilt value (either x- or y-axis) is meaningful. | |
| Point< int > | getPosition () const noexcept |
| The position of the mouse when the event occurred. | |
| int | getScreenX () const |
| Returns the mouse x position of this event, in global screen coordinates. | |
| int | getScreenY () const |
| Returns the mouse y position of this event, in global screen coordinates. | |
| Point< int > | getScreenPosition () const |
| Returns the mouse position of this event, in global screen coordinates. | |
| int | getMouseDownScreenX () const |
| Returns the x coordinate at which the mouse button was last pressed. | |
| int | getMouseDownScreenY () const |
| Returns the y coordinate at which the mouse button was last pressed. | |
| Point< int > | getMouseDownScreenPosition () const |
| Returns the coordinates at which the mouse button was last pressed. | |
| MouseEvent | getEventRelativeTo (Component *newComponent) const noexcept |
| Creates a version of this event that is relative to a different component. | |
| MouseEvent | withNewPosition (Point< float > newPosition) const noexcept |
| Creates a copy of this event with a different position. | |
| MouseEvent | withNewPosition (Point< int > newPosition) const noexcept |
| Creates a copy of this event with a different position. | |
Static Public Member Functions | |
| static void | setDoubleClickTimeout (int timeOutMilliseconds) noexcept |
| Changes the application-wide setting for the double-click time limit. | |
| static int | getDoubleClickTimeout () noexcept |
| Returns the application-wide setting for the double-click time limit. | |
Public Attributes | |
| const Point< float > | position |
| The position of the mouse when the event occurred. | |
| const int | x |
| The x-position of the mouse when the event occurred. | |
| const int | y |
| The y-position of the mouse when the event occurred. | |
| const ModifierKeys | mods |
| The key modifiers associated with the event. | |
| const float | pressure |
| The pressure of the touch or stylus for this event. | |
| const float | orientation |
| The orientation of the touch input for this event in radians where 0 indicates a touch aligned with the x-axis and pointing from left to right; increasing values indicate rotation in the clockwise direction. | |
| const float | rotation |
| The rotation of the pen device for this event in radians. | |
| const float | tiltX |
| The tilt of the pen device along the x-axis between -1.0 and 1.0. | |
| const float | tiltY |
| The tilt of the pen device along the y-axis between -1.0 and 1.0. | |
| const Point< float > | mouseDownPosition |
| The coordinates of the last place that a mouse button was pressed. | |
| Component *const | eventComponent |
| The component that this event applies to. | |
| Component *const | originalComponent |
| The component that the event first occurred on. | |
| const Time | eventTime |
| The time that this mouse-event occurred. | |
| const Time | mouseDownTime |
| The time that the corresponding mouse-down event occurred. | |
| MouseInputSource | source |
| The source device that generated this event. | |
Contains position and status information about a mouse event.
@tags{GUI}
Definition at line 38 of file juce_MouseEvent.h.
|
noexcept |
Creates a MouseEvent.
Normally an application will never need to use this.
| source | the source that's invoking the event |
| position | the position of the mouse, relative to the component that is passed-in |
| modifiers | the key modifiers at the time of the event |
| pressure | the pressure of the touch or stylus, in the range 0 to 1. Devices that do not support force information may return 0.0, 1.0, or a negative value, depending on the platform |
| orientation | the orientation of the touch input for this event in radians. The default is 0 |
| rotation | the rotation of the pen device for this event in radians. The default is 0 |
| tiltX | the tilt of the pen device along the x-axis between -1.0 and 1.0. The default is 0 |
| tiltY | the tilt of the pen device along the y-axis between -1.0 and 1.0. The default is 0 |
| eventComponent | the component that the mouse event applies to |
| originator | the component that originally received the event |
| eventTime | the time the event happened |
| mouseDownPos | the position of the corresponding mouse-down event (relative to the component that is passed-in). If there isn't a corresponding mouse-down (e.g. for a mouse-move), this will just be the same as the current mouse-x position. |
| mouseDownTime | the time at which the corresponding mouse-down event happened If there isn't a corresponding mouse-down (e.g. for a mouse-move), this will just be the same as the current mouse-event time. |
| numberOfClicks | how many clicks, e.g. a double-click event will be 2, a triple-click will be 3, etc |
| mouseWasDragged | whether the mouse has been dragged significantly since the previous mouse-down |
Definition at line 29 of file juce_MouseEvent.cpp.
|
noexcept |
Returns the straight-line distance between where the mouse is now and where it was the last time the button was pressed.
This is quite handy for things like deciding whether the user has moved far enough for it to be considered a drag operation.
Definition at line 113 of file juce_MouseEvent.cpp.
|
noexcept |
Returns the difference between the mouse's current x position and where it was when the button was last pressed.
Definition at line 118 of file juce_MouseEvent.cpp.
|
noexcept |
Returns the difference between the mouse's current y position and where it was when the button was last pressed.
Definition at line 119 of file juce_MouseEvent.cpp.
|
staticnoexcept |
Returns the application-wide setting for the double-click time limit.
This is the maximum length of time between mouse-clicks for it to be considered a double-click. It's used by the Component class.
Definition at line 135 of file juce_MouseEvent.cpp.
|
noexcept |
Creates a version of this event that is relative to a different component.
The x and y positions of the event that is returned will have been adjusted to be relative to the new component. The component pointer that is passed-in must not be null.
Definition at line 61 of file juce_MouseEvent.cpp.
|
noexcept |
Returns the time that the mouse button has been held down for.
If called from a mouseDrag or mouseUp callback, this will return the number of milliseconds since the corresponding mouseDown event occurred. If called in other contexts, e.g. a mouseMove, then the returned value may be 0 or an undefined value.
Definition at line 97 of file juce_MouseEvent.cpp.
Returns the coordinates of the last place that a mouse was pressed.
The coordinates are relative to the component specified in MouseEvent::component. For a floating point version of this value, see mouseDownPosition.
Definition at line 109 of file juce_MouseEvent.cpp.
Returns the coordinates at which the mouse button was last pressed.
The coordinates are relative to the top-left of the main monitor.
Definition at line 110 of file juce_MouseEvent.cpp.
| int juce::MouseEvent::getMouseDownScreenX | ( | ) | const |
Returns the x coordinate at which the mouse button was last pressed.
The coordinates are relative to the top-left of the main monitor.
Definition at line 124 of file juce_MouseEvent.cpp.
| int juce::MouseEvent::getMouseDownScreenY | ( | ) | const |
Returns the y coordinate at which the mouse button was last pressed.
The coordinates are relative to the top-left of the main monitor.
Definition at line 125 of file juce_MouseEvent.cpp.
|
noexcept |
Returns the x coordinate of the last place that a mouse was pressed.
The coordinate is relative to the component specified in MouseEvent::component.
Definition at line 115 of file juce_MouseEvent.cpp.
|
noexcept |
Returns the y coordinate of the last place that a mouse was pressed.
The coordinate is relative to the component specified in MouseEvent::component.
Definition at line 116 of file juce_MouseEvent.cpp.
|
noexcept |
For a click event, the number of times the mouse was clicked in succession.
So for example a double-click event will return 2, a triple-click 3, etc.
Definition at line 267 of file juce_MouseEvent.h.
Returns the difference between the mouse's current position and where it was when the button was last pressed.
Definition at line 112 of file juce_MouseEvent.cpp.
The position of the mouse when the event occurred.
This position is relative to the top-left of the component to which the event applies (as indicated by the MouseEvent::eventComponent field).
For a floating-point position, see MouseEvent::position
Definition at line 106 of file juce_MouseEvent.cpp.
Returns the mouse position of this event, in global screen coordinates.
The coordinates are relative to the top-left of the main monitor.
Definition at line 107 of file juce_MouseEvent.cpp.
| int juce::MouseEvent::getScreenX | ( | ) | const |
Returns the mouse x position of this event, in global screen coordinates.
The coordinates are relative to the top-left of the main monitor.
Definition at line 121 of file juce_MouseEvent.cpp.
| int juce::MouseEvent::getScreenY | ( | ) | const |
Returns the mouse y position of this event, in global screen coordinates.
The coordinates are relative to the top-left of the main monitor.
Definition at line 122 of file juce_MouseEvent.cpp.
|
noexcept |
Returns true if the orientation value for this event is meaningful.
Definition at line 128 of file juce_MouseEvent.cpp.
|
noexcept |
Returns true if the pressure value for this event is meaningful.
Definition at line 127 of file juce_MouseEvent.cpp.
|
noexcept |
Returns true if the rotation value for this event is meaningful.
Definition at line 129 of file juce_MouseEvent.cpp.
Returns true if the current tilt value (either x- or y-axis) is meaningful.
Definition at line 130 of file juce_MouseEvent.cpp.
|
noexcept |
Returns true if the mouse event is part of a click gesture rather than a drag.
This is effectively the opposite of mouseWasDraggedSinceMouseDown()
Definition at line 92 of file juce_MouseEvent.cpp.
|
noexcept |
Returns true if the user seems to be performing a drag gesture.
This is only meaningful if called in either a mouseUp() or mouseDrag() method.
It will return true if the user has dragged the mouse more than a few pixels from the place where the mouse-down occurred or the mouse has been held down for a significant amount of time.
Once they have dragged it far enough for this method to return true, it will continue to return true until the mouse-up, even if they move the mouse back to the same location at which the mouse-down happened. This means that it's very handy for objects that can either be clicked on or dragged, as you can use it in the mouseDrag() callback to ignore small movements they might make while trying to click.
Definition at line 87 of file juce_MouseEvent.cpp.
Changes the application-wide setting for the double-click time limit.
This is the maximum length of time between mouse-clicks for it to be considered a double-click. It's used by the Component class.
Definition at line 136 of file juce_MouseEvent.cpp.
|
noexcept |
Creates a copy of this event with a different position.
All other members of the event object are the same, but the x and y are replaced with these new values.
Definition at line 72 of file juce_MouseEvent.cpp.
|
noexcept |
Creates a copy of this event with a different position.
All other members of the event object are the same, but the x and y are replaced with these new values.
Definition at line 79 of file juce_MouseEvent.cpp.
The component that this event applies to.
This is usually the component that the mouse was over at the time, but for mouse-drag events the mouse could actually be over a different component and the events are still sent to the component that the button was originally pressed on.
The x and y member variables are relative to this component's position.
If you use getEventRelativeTo() to retarget this object to be relative to a different component, this pointer will be updated, but originalComponent remains unchanged.
Definition at line 173 of file juce_MouseEvent.h.
The time that this mouse-event occurred.
Definition at line 185 of file juce_MouseEvent.h.
| const ModifierKeys juce::MouseEvent::mods |
The key modifiers associated with the event.
This will let you find out which mouse buttons were down, as well as which modifier keys were held down.
When used for mouse-up events, this will indicate the state of the mouse buttons just before they were released, so that you can tell which button they let go of.
Definition at line 125 of file juce_MouseEvent.h.
The coordinates of the last place that a mouse button was pressed.
The coordinates are relative to the component specified in MouseEvent::component.
Definition at line 158 of file juce_MouseEvent.h.
The time that the corresponding mouse-down event occurred.
Definition at line 188 of file juce_MouseEvent.h.
The orientation of the touch input for this event in radians where 0 indicates a touch aligned with the x-axis and pointing from left to right; increasing values indicate rotation in the clockwise direction.
The default is 0.
Definition at line 137 of file juce_MouseEvent.h.
The component that the event first occurred on.
If you use getEventRelativeTo() to retarget this object to be relative to a different component, this value remains unchanged to indicate the first component that received it.
Definition at line 182 of file juce_MouseEvent.h.
The position of the mouse when the event occurred.
This value is relative to the top-left of the component to which the event applies (as indicated by the MouseEvent::eventComponent field).
This is a more accurate floating-point version of the position returned by getPosition() and the integer x and y member variables.
Definition at line 97 of file juce_MouseEvent.h.
The pressure of the touch or stylus for this event.
The range is 0 (soft) to 1 (hard). If the input device doesn't provide any pressure data, it may return a negative value here, or 0.0 or 1.0, depending on the platform.
Definition at line 132 of file juce_MouseEvent.h.
The rotation of the pen device for this event in radians.
Indicates the clockwise rotation, or twist, of the pen. The default is 0.
Definition at line 142 of file juce_MouseEvent.h.
| MouseInputSource juce::MouseEvent::source |
The source device that generated this event.
Definition at line 191 of file juce_MouseEvent.h.
The tilt of the pen device along the x-axis between -1.0 and 1.0.
A positive value indicates a tilt to the right. The default is 0.
Definition at line 147 of file juce_MouseEvent.h.
The tilt of the pen device along the y-axis between -1.0 and 1.0.
A positive value indicates a tilt toward the user. The default is 0.
Definition at line 152 of file juce_MouseEvent.h.
The x-position of the mouse when the event occurred.
This value is relative to the top-left of the component to which the event applies (as indicated by the MouseEvent::eventComponent field).
For a floating-point coordinate, see MouseEvent::position
Definition at line 106 of file juce_MouseEvent.h.
The y-position of the mouse when the event occurred.
This value is relative to the top-left of the component to which the event applies (as indicated by the MouseEvent::eventComponent field).
For a floating-point coordinate, see MouseEvent::position
Definition at line 115 of file juce_MouseEvent.h.