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
Loading...
Searching...
No Matches
juce_MouseEvent.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
38class JUCE_API MouseEvent final
39{
40public:
41 //==============================================================================
69 Point<float> position,
70 ModifierKeys modifiers,
71 float pressure,
72 float orientation, float rotation,
73 float tiltX, float tiltY,
74 Component* eventComponent,
75 Component* originator,
76 Time eventTime,
77 Point<float> mouseDownPos,
78 Time mouseDownTime,
79 int numberOfClicks,
80 bool mouseWasDragged) noexcept;
81
82 MouseEvent (const MouseEvent&) = default;
83 MouseEvent& operator= (const MouseEvent&) = delete;
84
85 MouseEvent (MouseEvent&&) = default;
86 MouseEvent& operator= (MouseEvent&&) = delete;
87
88 //==============================================================================
98
106 const int x;
107
115 const int y;
116
126
132 const float pressure;
133
137 const float orientation;
138
142 const float rotation;
143
147 const float tiltX;
148
152 const float tiltY;
153
159
174
183
186
189
192
193 //==============================================================================
198 int getMouseDownX() const noexcept;
199
204 int getMouseDownY() const noexcept;
205
211 Point<int> getMouseDownPosition() const noexcept;
212
221 int getDistanceFromDragStart() const noexcept;
222
228 int getDistanceFromDragStartX() const noexcept;
229
235 int getDistanceFromDragStartY() const noexcept;
236
242 Point<int> getOffsetFromDragStart() const noexcept;
243
257 bool mouseWasDraggedSinceMouseDown() const noexcept;
258
262 bool mouseWasClicked() const noexcept;
263
267 int getNumberOfClicks() const noexcept { return numberOfClicks; }
268
276 int getLengthOfMousePress() const noexcept;
277
279 bool isPressureValid() const noexcept;
280
282 bool isOrientationValid() const noexcept;
283
285 bool isRotationValid() const noexcept;
286
288 bool isTiltValid (bool tiltX) const noexcept;
289
290 //==============================================================================
298 Point<int> getPosition() const noexcept;
299
304 int getScreenX() const;
305
310 int getScreenY() const;
311
316 Point<int> getScreenPosition() const;
317
322 int getMouseDownScreenX() const;
323
328 int getMouseDownScreenY() const;
329
334 Point<int> getMouseDownScreenPosition() const;
335
336 //==============================================================================
343 MouseEvent getEventRelativeTo (Component* newComponent) const noexcept;
344
349 MouseEvent withNewPosition (Point<float> newPosition) const noexcept;
350
355 MouseEvent withNewPosition (Point<int> newPosition) const noexcept;
356
357 //==============================================================================
365 static void setDoubleClickTimeout (int timeOutMilliseconds) noexcept;
366
374 static int getDoubleClickTimeout() noexcept;
375
376
377private:
378 //==============================================================================
379 const uint8 numberOfClicks, wasMovedSinceMouseDown;
380};
381
382
383//==============================================================================
392{
393 //==============================================================================
401 float deltaX;
402
410 float deltaY;
411
416
419
423};
424
425//==============================================================================
433struct PenDetails final
434{
439 float rotation;
440
445 float tiltX;
446
451 float tiltY;
452};
453
454} // namespace juce
The base class for all JUCE user-interface objects.
Represents the state of the mouse buttons and modifier keys.
Contains position and status information about a mouse event.
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.
const ModifierKeys mods
The key modifiers associated with the event.
MouseInputSource source
The source device that generated this event.
const Time mouseDownTime
The time that the corresponding mouse-down event occurred.
Component *const originalComponent
The component that the event first occurred on.
const float orientation
The orientation of the touch input for this event in radians where 0 indicates a touch aligned with t...
const int x
The x-position of the mouse when the event occurred.
const float pressure
The pressure of the touch or stylus for this event.
const Point< float > position
The position of the mouse when the event occurred.
const int y
The y-position of the mouse when the event occurred.
const float rotation
The rotation of the pen device for this event in radians.
const Time eventTime
The time that this mouse-event occurred.
Component *const eventComponent
The component that this event applies to.
const float tiltX
The tilt of the pen device along the x-axis between -1.0 and 1.0.
Represents a linear source of mouse events from a mouse device or individual finger in a multi-touch ...
A pair of (x, y) coordinates.
Definition juce_Point.h:42
Holds an absolute date and time.
Definition juce_Time.h:37
JUCE Namespace.
bool isInertial
If true, then this event is part of the inertial momentum phase that follows the wheel being released...
float rotation
The rotation of the pen device in radians.
float tiltX
Indicates the angle of tilt of the pointer in a range of -1.0 to 1.0 along the x-axis where a positiv...
float tiltY
Indicates the angle of tilt of the pointer in a range of -1.0 to 1.0 along the y-axis where a positiv...
bool isReversed
Indicates whether the user has reversed the direction of the wheel.
float deltaY
The amount that the wheel has been moved in the Y axis.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88
float deltaX
The amount that the wheel has been moved in the X axis.
bool isSmooth
If true, then the wheel has continuous, un-stepped motion.
unsigned char uint8
A platform-independent 8-bit unsigned integer type.
Contains status information about a mouse wheel event.
Contains status information about a pen event.