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_MouseInputSource.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//==============================================================================
51class JUCE_API MouseInputSource final
52{
53public:
56 {
57 mouse,
58 touch,
59 pen
60 };
61
62 //==============================================================================
63 MouseInputSource (const MouseInputSource&) noexcept;
64 MouseInputSource& operator= (const MouseInputSource&) noexcept;
65 ~MouseInputSource() noexcept;
66
67 //==============================================================================
68 bool operator== (const MouseInputSource& other) const noexcept { return pimpl == other.pimpl; }
69 bool operator!= (const MouseInputSource& other) const noexcept { return pimpl != other.pimpl; }
70
71 //==============================================================================
73 MouseInputSource::InputSourceType getType() const noexcept;
74
76 bool isMouse() const noexcept;
77
79 bool isTouch() const noexcept;
80
82 bool isPen() const noexcept;
83
87 bool canHover() const noexcept;
88
90 bool hasMouseWheel() const noexcept;
91
101 int getIndex() const noexcept;
102
104 bool isDragging() const noexcept;
105
107 Point<float> getScreenPosition() const noexcept;
108
110 Point<float> getRawScreenPosition() const noexcept;
111
115 ModifierKeys getCurrentModifiers() const noexcept;
116
122 float getCurrentPressure() const noexcept;
123
128 float getCurrentOrientation() const noexcept;
129
133 float getCurrentRotation() const noexcept;
134
139 float getCurrentTilt (bool tiltX) const noexcept;
140
142 bool isPressureValid() const noexcept;
143
145 bool isOrientationValid() const noexcept;
146
148 bool isRotationValid() const noexcept;
149
151 bool isTiltValid (bool tiltX) const noexcept;
152
154 Component* getComponentUnderMouse() const;
155
159 void triggerFakeMove() const;
160
166 int getNumberOfMultipleClicks() const noexcept;
167
169 Time getLastMouseDownTime() const noexcept;
170
172 Point<float> getLastMouseDownPosition() const noexcept;
173
176 bool isLongPressOrDrag() const noexcept;
177
179 bool hasMovedSignificantlySincePressed() const noexcept;
180
182 bool hasMouseCursor() const noexcept;
183
185 void showMouseCursor (const MouseCursor& cursor);
186
188 void hideCursor();
189
191 void revealCursor();
192
194 void forceMouseCursorUpdate();
195
197 bool canDoUnboundedMovement() const noexcept;
198
216 void enableUnboundedMouseMovement (bool isEnabled, bool keepCursorVisibleUntilOffscreen = false) const;
217
219 bool isUnboundedMouseMovementEnabled() const;
220
222 void setScreenPosition (Point<float> newPosition);
223
227 static constexpr float defaultPressure = 0.0f;
228
230 static constexpr float defaultOrientation = 0.0f;
231
233 static constexpr float defaultRotation = 0.0f;
234
236 static constexpr float defaultTiltX = 0.0f;
237 static constexpr float defaultTiltY = 0.0f;
238
244 [[deprecated ("Use defaultPressure instead.")]]
245 static const float invalidPressure;
246
252 [[deprecated ("Use defaultOrientation instead.")]]
253 static const float invalidOrientation;
254
260 [[deprecated ("Use defaultRotation instead.")]]
261 static const float invalidRotation;
262
268 [[deprecated ("Use defaultTiltX instead.")]]
269 static const float invalidTiltX;
270 [[deprecated ("Use defaultTiltY instead.")]]
271 static const float invalidTiltY;
272
276 static const Point<float> offscreenMousePos;
277
278 //==============================================================================
279 #ifndef DOXYGEN
280 [[deprecated ("This method has been replaced with the isLongPressOrDrag and hasMovedSignificantlySincePressed "
281 "methods. If you want the same behaviour you should use isLongPressOrDrag which accounts for the "
282 "amount of time that the input source has been held down for, but if you only want to know whether "
283 "it has been moved use hasMovedSignificantlySincePressed instead.")]]
284 bool hasMouseMovedSignificantlySincePressed() const noexcept;
285 #endif
286
287private:
288 //==============================================================================
289 friend class ComponentPeer;
290 friend class Desktop;
291 friend class detail::MouseInputSourceList;
292 friend class detail::MouseInputSourceImpl;
294
296 void handleEvent (ComponentPeer&, Point<float>, int64 time, ModifierKeys, float, float, const PenDetails&);
297 void handleWheel (ComponentPeer&, Point<float>, int64 time, const MouseWheelDetails&);
298 void handleMagnifyGesture (ComponentPeer&, Point<float>, int64 time, float scaleFactor);
299
300 static Point<float> getCurrentRawMousePosition();
301 static void setRawMousePosition (Point<float>);
302
304};
305
306} // namespace juce
The Component class uses a ComponentPeer internally to create and manage a real operating-system wind...
Describes and controls aspects of the computer's desktop.
Represents the state of the mouse buttons and modifier keys.
Represents a linear source of mouse events from a mouse device or individual finger in a multi-touch ...
InputSourceType
Possible mouse input sources.
A pair of (x, y) coordinates.
Definition juce_Point.h:42
#define JUCE_LEAK_DETECTOR(OwnerClass)
This macro lets you embed a leak-detecting object inside a class.
JUCE Namespace.
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
long long int64
A platform-independent 64-bit integer type.
Contains status information about a mouse wheel event.
Contains status information about a pen event.