Gamp v0.0.7-36-g24b1eb6
Gamp: Graphics, Audio, Multimedia and Processing
Loading...
Searching...
No Matches
PointerEvent.hpp
Go to the documentation of this file.
1/*
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2010-2025 Gothel Software e.K.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24#ifndef GAMP_WTPOINTEREVENT_HPP_
25#define GAMP_WTPOINTEREVENT_HPP_
26
27#include <cstdint>
28#include <vector>
29
30#include <jau/basic_types.hpp>
31#include <jau/bitfield.hpp>
32#include <jau/cpp_lang_util.hpp>
33#include <jau/enum_util.hpp>
34#include <jau/fraction_type.hpp>
35#include <jau/int_math_ct.hpp>
36#include <jau/io_util.hpp>
37#include <jau/math/vec2i.hpp>
38#include <jau/math/vec3f.hpp>
39#include <jau/string_util.hpp>
40
41#include <gamp/GampTypes.hpp>
43
44namespace gamp::wt::event {
45 /** \addtogroup Gamp_WT
46 *
47 * @{
48 */
49
50 using namespace jau::enums;
51
52 /** Class of pointer types */
53 enum class PointerClass : uint16_t {
54 none = 0,
55 /** Desktop compatibility profile. */
56 offscreen = 1U << 14,
57 /** Desktop core profile. */
58 onscreen = 1U << 15
59 };
61
62 /** Type of pointer devices */
63 enum class PointerType : uint16_t {
64 none = 0,
65 /** Mouse */
67 /** Touch pad, fingers off screen */
69 /** Touch screen, fingers on screen. */
71 /** Pen usually off-screen */
73 };
75
76 constexpr PointerClass getPointerClass(PointerType pt) noexcept {
77 const uint16_t m = 1U << 15 | 1U << 14;
78 return static_cast<PointerClass>(number(pt) & m);
79 }
80
81 /**
82 * Pointer event of type PointerType.
83 *
84 * See also [W3C pointerevent-interface](http://www.w3.org/Submission/pointer-events/#pointerevent-interface).
85 *
86 * <a name="coordUnit"><h5>Unit of Coordinates</h5></a>
87 *
88 * All pointer coordinates of this interface are represented in pixel units, see Surface and Window.
89 *
90 * Orientation of coordinate system depends on Window::isPointerBLOriented(), i.e. defaults to bottom-left.
91 *
92 * <a name="multiPtrEvent"><h5>Multiple-Pointer Events</h5></a>
93 *
94 * In case an instance represents a multiple-pointer event, i.e. {@link #getPointerCount()} is &gt; 1,
95 * the first data element of the multiple-pointer fields represents the pointer triggering this event.<br/>
96 * For example {@link #getX(int) e.getX(0)} at {@link #EVENT_POINTER_PRESSED} returns the data of the pressed pointer, etc.
97 *
98 * Multiple-pointer event's {@link #getButton() button number} is mapped to the <i>first {@link #getPointerId(int) pointer ID}</i>
99 * triggering the event and the {@link InputEvent#BUTTON1_MASK button mask bits} in the {@link #getModifiers() modifiers}
100 * field represent the pressed pointer IDs.
101 *
102 * Users can query the pressed button and pointer count via {@link InputEvent#getButtonDownCount()}
103 * or use the simple query {@link InputEvent#isAnyButtonDown()}.
104 *
105 * If representing a single-pointer {@link PointerType#Mouse} event, {@link #getPointerId(int) pointer-ID} is <code>0</code>
106 * and a {@link #getButton() button value} of <code>0</code> denotes no button activity, i.e. {@link PointerType#Mouse} move.
107 */
108 class PointerEvent : public InputEvent {
109 public:
110 /** Returns the 3-axis XYZ rotation array by given rotation on Y axis or X axis (if InputModifier::shift is given in mods). */
111 static jau::math::Vec3f swapRotation(float rotationXorY, InputModifier mods) {
114 res.x = rotationXorY;
115 } else {
116 res.y = rotationXorY;
117 }
118 return res;
119 }
120
121 constexpr static uint16_t clickTimeout() { return 300; }
122
123 /**
124 * Constructor for traditional one-pointer event.
125 *
126 * @param eventType
127 * @param source
128 * @param when
129 * @param modifiers
130 * @param pos XY-axis
131 * @param clickCount Mouse-button click-count
132 * @param button button number, e.g. [{@link #BUTTON1}..{@link #BUTTON_COUNT}-1].
133 * A button value of <code>0</code> denotes no button activity, i.e. {@link PointerType#Mouse} move.
134 * @param rotation Rotation of all axis
135 * @param rotationScale Rotation scale
136 */
138 PointerType ptype, uint16_t id,
141 : InputEvent(type, when, source, mods),
142 m_clickCount(clickCount), m_button(button),
143 m_rotation(rotation), m_rotationScale(rotationScale), m_maxPressure(1.0f)
144 {
145 m_pos.push_back(pos);
146 switch( type ) {
150 m_pressure.push_back(constMousePressure1);
151 break;
152 default:
153 m_pressure.push_back(constMousePressure0);
154 }
155 m_pointerID.push_back(id);
156 m_pointerType.push_back(ptype);
157 }
158
159 /**
160 * Constructor for a multiple-pointer event.
161 * <p>
162 * First element of multiple-pointer arrays represents the pointer which triggered the event!
163 * </p>
164 * <p>
165 * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
166 * </p>
167 *
168 * @param eventType
169 * @param source
170 * @param when
171 * @param modifiers
172 * @param pointerType PointerType for each pointer (multiple pointer)
173 * @param pointerID Pointer ID for each pointer (multiple pointer). IDs start w/ 0 and are consecutive numbers.
174 * A pointer-ID of -1 may also denote no pointer/button activity, i.e. {@link PointerType#Mouse} move.
175 * @param pos XY-axis for each pointer (multiple pointer)
176 * @param pressure Pressure for each pointer (multiple pointer)
177 * @param maxPressure Maximum pointer pressure for all pointer
178 * @param button Corresponding mouse-button
179 * @param clickCount Mouse-button click-count
180 * @param rotation Rotation of all axis
181 * @param rotationScale Rotation scale
182 */
184 const std::vector<PointerType>& pointerType, const std::vector<uint16_t>& pointerID,
185 const std::vector<jau::math::Vec2i>& pos, const std::vector<float>& pressure, float maxPressure,
186 uint16_t clickCount, InputButton button,
188 : InputEvent(type, when, source, mods) {
189 m_pos = pos;
190 const size_t pointerCount = pointerType.size();
191 if( pointerCount != pointerID.size() ||
192 pointerCount != m_pos.size() ||
193 pointerCount != m_pressure.size() ) {
194 throw jau::IllegalArgumentError("All multiple pointer arrays must be of same size", E_FILE_LINE);
195 }
196 if( 0.0f >= maxPressure ) {
197 throw jau::IllegalArgumentError("maxPressure must be > 0.0f", E_FILE_LINE);
198 }
199 m_pressure = pressure;
200 m_maxPressure = maxPressure;
201 m_pointerID = pointerID;
202 m_clickCount = clickCount;
203 m_button = button;
204 m_rotation = rotation;
205 m_rotationScale = rotationScale;
206 m_pointerType = pointerType;
207 }
208
209 PointerEvent createVariant(uint16_t newEventType) {
210 WindowRef s = source().lock();
211 return PointerEvent(newEventType, when(), s, modifier(), allPointerTypes(), allPointerIDs(),
212 m_pos, m_pressure, m_maxPressure, m_clickCount, m_button, m_rotation, m_rotationScale);
213 }
214
215 /**
216 * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
217 * @return the count of pointers involved in this event
218 */
219 constexpr size_t pointerCount() const noexcept { return m_pointerType.size(); }
220
221 /**
222 * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
223 * @return the {@link PointerType} for the data at index or null if index not available.
224 */
225 constexpr PointerType pointerType(size_t index) const noexcept {
226 if( index >= m_pointerType.size() ) {
227 return PointerType::none;
228 }
229 return m_pointerType[index];
230 }
231
232 /**
233 * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
234 * @return array of all {@link PointerType}s for all pointers
235 */
236 constexpr const std::vector<PointerType>& allPointerTypes() const noexcept { return m_pointerType; }
237
238 /**
239 * Return the pointer id for the given index or -1 if index not available.
240 * <p>
241 * IDs start w/ 0 and are consecutive numbers.
242 * </p>
243 * <p>
244 * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
245 * </p>
246 */
247 constexpr int pointerId(size_t index = 0) const noexcept {
248 if( index >= m_pointerID.size() ) {
249 return -1;
250 }
251 return m_pointerID[index];
252 }
253
254 /**
255 * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
256 * @return the pointer index for the given pointer id or -1 if id not available.
257 */
258 int pointerIdx(uint16_t id) const {
259 for( int i = gamp::castOrThrow<size_t, int>(m_pointerID.size() - 1); i >= 0; i-- ) {
260 if( m_pointerID[i] == id ) {
261 return i;
262 }
263 }
264 return -1;
265 }
266
267 /**
268 * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
269 * @return array of all pointer IDs for all pointers. IDs start w/ 0 and are consecutive numbers.
270 */
271 constexpr const std::vector<uint16_t>& allPointerIDs() const noexcept { return m_pointerID; }
272
273 /**
274 * Returns the button number, e.g. [{@link #BUTTON1}..{@link #BUTTON_COUNT}-1].
275 * <p>
276 * A button value of <code>0</code> denotes no button activity, i.e. {@link PointerType#Mouse} move.
277 * </p>
278 * <p>
279 * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
280 * </p>
281 */
282 constexpr InputButton button() const noexcept { return m_button; }
283
284 constexpr uint16_t clickCount() const noexcept { return m_clickCount; }
285
286 /**
287 * Returns position of given pointer-index in pixel units. Orientation depends on Window::isPointerBLOriented().
288 *
289 * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
290 * @param index pointer-index within [0 .. {@link #getPointerCount()}-1]
291 * @return XYZ-Coord associated with the pointer-index in pixel units.
292 * @see getPointerId(index)
293 */
294 constexpr const jau::math::Vec2i& position(size_t index = 0) const noexcept { return m_pos[index]; }
295
296 /**
297 * Returns position of all pointers in pixel units. Orientation depends on Window::isPointerBLOriented().
298 *
299 * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
300 * @return array of all coordinates for all pointers in pixel units.
301 */
302 constexpr const std::vector<jau::math::Vec2i>& allPositions() const noexcept { return m_pos; }
303
304 /**
305 * @param normalized if true, method returns the normalized pressure, i.e. <code>pressure / maxPressure</code>
306 * @return The pressure associated with the pointer-index 0.
307 * The value of zero is return if not available.
308 * @see #getMaxPressure()
309 */
310 constexpr float pressure(bool normalized) const noexcept { return pressure(0, normalized); }
311
312 /**
313 * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
314 * @param index pointer-index within [0 .. {@link #getPointerCount()}-1]
315 * @param normalized if true, method returns the normalized pressure, i.e. <code>pressure / maxPressure</code>
316 * @return The pressure associated with the pointer-index.
317 * The value of zero is return if not available.
318 * @see #getMaxPressure()
319 */
320 constexpr float pressure(size_t index, bool normalized) const noexcept {
321 return normalized ? m_pressure[index] / m_maxPressure : m_pressure[index];
322 }
323
324 /**
325 * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
326 * @return array of all raw, un-normalized pressures for all pointers
327 */
328 constexpr const std::vector<float>& allPressures() const noexcept { return m_pressure; }
329
330 /**
331 * Returns the maximum pressure known for the input device generating this event.
332 * <p>
333 * This value may be self calibrating on devices/OS, where no known maximum pressure is known.
334 * Hence subsequent events may return a higher value.
335 * </p>
336 * <p>
337 * Self calibrating maximum pressure is performed on:
338 * <ul>
339 * <li>Android</li>
340 * </ul>
341 * </p>
342 */
343 constexpr float maxPressure() const noexcept { return m_maxPressure; }
344
345 /**
346 * Returns a 3-component float array filled with the values of the rotational axis
347 * in the following order: horizontal-, vertical- and z-axis.
348 * <p>
349 * A vertical rotation of <b>&gt; 0.0f is up</b> and <b>&lt; 0.0f is down</b>.
350 * </p>
351 * <p>
352 * A horizontal rotation of <b>&gt; 0.0f is left</b> and <b>&lt; 0.0f is right</b>.
353 * </p>
354 * <p>
355 * A z-axis rotation of <b>&gt; 0.0f is back</b> and <b>&lt; 0.0f is front</b>.
356 * </p>
357 * <p>
358 * <i>However</i>, on some OS this might be flipped due to the OS <i>default</i> behavior.
359 * The latter is true for OS X 10.7 (Lion) for example.
360 * </p>
361 * <p>
362 * On PointerClass {@link PointerClass#Onscreen onscreen} devices, i.e. {@link PointerType#TouchScreen touch screens},
363 * rotation events are usually produced by a 2-finger movement, where horizontal and vertical rotation values are filled.
364 * </p>
365 * <p>
366 * On PointerClass {@link PointerClass#Offscreen offscreen} devices, i.e. {@link PointerType#Mouse mouse},
367 * either the horizontal or the vertical rotation value is filled.
368 * </p>
369 * <p>
370 * The {@link InputEvent#SHIFT_MASK} modifier is set in case <b>|horizontal| &gt; |vertical|</b> value.<br/>
371 * This can be utilized to implement only one 2d rotation direction, you may use {@link #isShiftDown()} to query it.
372 * </p>
373 * <p>
374 * In case the pointer type is {@link PointerType#Mouse mouse},
375 * events are usually send in steps of one, ie. <i>-1.0f</i> and <i>1.0f</i>.
376 * Higher values may result due to fast scrolling.
377 * Fractional values may result due to slow scrolling with high resolution devices.<br/>
378 * Here the button number refers to the wheel number.
379 * </p>
380 * <p>
381 * In case the pointer type is of class {@link PointerClass#Onscreen}, e.g. {@link PointerType#TouchScreen touch screen},
382 * see {@link #getRotationScale()} for semantics.
383 * </p>
384 */
385 constexpr const jau::math::Vec3f& rotation() const noexcept { return m_rotation; }
386
387 /**
388 * Returns the scale used to determine the {@link #getRotation() rotation value},
389 * which semantics depends on the {@link #getPointerType() pointer type's} {@link PointerClass}.
390 * <p>
391 * For {@link PointerClass#Offscreen}, the scale is usually <code>1.0f</code> and denominates
392 * an abstract value without association to a physical value.
393 * </p>
394 * <p>
395 * For {@link PointerClass#Onscreen}, the scale varies and denominates
396 * the divisor of the distance the finger[s] have moved on the screen.
397 * Hence <code>scale * rotation</code> reproduces the screen distance in pixels the finger[s] have moved.
398 * </p>
399 */
400 constexpr float rotationScale() const noexcept { return m_rotationScale; }
401
402 std::string toString() const noexcept {
403 std::string sb = "PointerEvent[";
404 sb.append(getEventTypeString())
405 .append(", pos[")
406 .append(jau::to_string(m_pos))
407 .append("], button ")
408 .append(to_string(m_button))
409 .append(", count ")
410 .append(std::to_string(m_clickCount));
411 if( type() == EVENT_POINTER_WHEEL ) {
412 sb.append(", rotation [")
413 .append(m_rotation.toString())
414 .append("] * ")
415 .append(std::to_string(m_rotationScale));
416 }
417 if( m_pointerID.size() > 0 ) {
418 sb.append(", pointer<").append(std::to_string(m_pointerID.size())).append(">[");
419 for( size_t i = 0; i < m_pointerID.size(); i++ ) {
420 if( i > 0 ) {
421 sb.append(", ");
422 }
423 sb.append(std::to_string(m_pointerID[i])).append("/").append(to_string(m_pointerType[i])).append(": ")
424 .append(m_pos[i].toString()).append(", ")
425 .append("p[").append(std::to_string(m_pressure[i])).append("/").append(std::to_string(m_maxPressure)).append("=")
426 .append(std::to_string(m_pressure[i] / m_maxPressure)).append("]");
427 }
428 sb.append("]");
429 }
430 sb.append(", ").append(InputEvent::toString()).append("]");
431 return sb;
432 }
433
434 private:
435 std::string getEventTypeString() const noexcept {
436 switch( type() ) {
437 case EVENT_POINTER_CLICKED: return "CLICKED";
438 case EVENT_POINTER_ENTERED: return "ENTERED";
439 case EVENT_POINTER_EXITED: return "EXITED";
440 case EVENT_POINTER_PRESSED: return "PRESSED";
441 case EVENT_POINTER_RELEASED: return "RELEASED";
442 case EVENT_POINTER_MOVED: return "MOVED";
443 case EVENT_POINTER_DRAGGED: return "DRAGGED";
444 case EVENT_POINTER_WHEEL: return "WHEEL";
445 default: return "unknown (" + std::to_string(type()) + ")";
446 }
447 }
448
449 /** PointerType for each pointer (multiple pointer) */
450 std::vector<PointerType> m_pointerType;
451 /** Pointer-ID for each pointer (multiple pointer). IDs start w/ 0 and are consecutive numbers. */
452 std::vector<uint16_t> m_pointerID;
453 /** XY-axis for each pointer (multiple pointer) */
454 std::vector<jau::math::Vec2i> m_pos;
455 /** Pressure for each pointer (multiple pointer) */
456 std::vector<float> m_pressure;
457 // private final uint16_t tiltX[], tiltY[]; // TODO: A generic way for pointer axis information, see Android MotionEvent!
458 uint16_t m_clickCount;
459 /**
460 * Returns the button number, e.g. [{@link #BUTTON1}..{@link #BUTTON_COUNT}-1].
461 * <p>
462 * A button value of <code>0</code> denotes no button activity, i.e. {@link PointerType#Mouse} move.
463 * </p>
464 */
465 InputButton m_button;
466 /** Rotation around the X, Y and X axis */
467 jau::math::Vec3f m_rotation;
468 /** Rotation scale */
469 float m_rotationScale;
470 float m_maxPressure;
471
472 constexpr static float constMousePressure0 = 0.0f;
473 constexpr static float constMousePressure1 = 1.0f;
474 constexpr static PointerType constMousePointerTypes = PointerType::mouse;
475 };
476
477 /**
478 * Listener for PointerEvent
479 *
480 * @see PointerEvent
481 */
483 public:
484 virtual ~PointerListener() noexcept = default;
485
486 virtual void pointerClicked(PointerEvent&) { }
487 /** Only generated for {@link PointerType#Mouse} */
488 virtual void pointerEntered(PointerEvent&) { }
489 /** Only generated for {@link PointerType#Mouse} */
490 virtual void pointerExited(PointerEvent&) { }
491 virtual void pointerPressed(PointerEvent&) { }
492 virtual void pointerReleased(PointerEvent&) { }
493 virtual void pointerMoved(PointerEvent&) { }
494 virtual void pointerDragged(PointerEvent&) { }
495
496 /**
497 * Traditional event name originally produced by a PointerType::mouse pointer type.
498 *
499 * Triggered for any rotational pointer events, see
500 * PointerEvent::rotation() and PointerEvent::rotationScale().
501 */
503 };
504 typedef std::shared_ptr<PointerListener> PointerListenerRef;
505
506 /**@}*/
507
508} // namespace gamp::wt::event
509
510#endif /* GAMP_WTPOINTEREVENT_HPP_ */
constexpr InputModifier modifier() const noexcept
Definition Event.hpp:210
InputEvent(uint16_t type, const jau::fraction_timespec &when, const WindowRef &source, InputModifier mods) noexcept
Definition Event.hpp:207
std::string toString() const noexcept
Definition Event.hpp:302
Pointer event of type PointerType.
constexpr uint16_t clickCount() const noexcept
constexpr const std::vector< float > & allPressures() const noexcept
See details for multiple-pointer events.
constexpr PointerType pointerType(size_t index) const noexcept
See details for multiple-pointer events.
constexpr InputButton button() const noexcept
Returns the button number, e.g.
constexpr float rotationScale() const noexcept
Returns the scale used to determine the rotation value, which semantics depends on the pointer type's...
constexpr int pointerId(size_t index=0) const noexcept
Return the pointer id for the given index or -1 if index not available.
std::string toString() const noexcept
constexpr const std::vector< PointerType > & allPointerTypes() const noexcept
See details for multiple-pointer events.
constexpr const jau::math::Vec2i & position(size_t index=0) const noexcept
Returns position of given pointer-index in pixel units.
int pointerIdx(uint16_t id) const
See details for multiple-pointer events.
static constexpr uint16_t clickTimeout()
constexpr float maxPressure() const noexcept
Returns the maximum pressure known for the input device generating this event.
constexpr const std::vector< uint16_t > & allPointerIDs() const noexcept
See details for multiple-pointer events.
constexpr float pressure(size_t index, bool normalized) const noexcept
See details for multiple-pointer events.
constexpr size_t pointerCount() const noexcept
See details for multiple-pointer events.
PointerEvent(uint16_t type, const jau::fraction_timespec &when, const WindowRef &source, InputModifier mods, const std::vector< PointerType > &pointerType, const std::vector< uint16_t > &pointerID, const std::vector< jau::math::Vec2i > &pos, const std::vector< float > &pressure, float maxPressure, uint16_t clickCount, InputButton button, const jau::math::Vec3f &rotation, float rotationScale)
Constructor for a multiple-pointer event.
constexpr const jau::math::Vec3f & rotation() const noexcept
Returns a 3-component float array filled with the values of the rotational axis in the following orde...
PointerEvent createVariant(uint16_t newEventType)
constexpr float pressure(bool normalized) const noexcept
PointerEvent(uint16_t type, const jau::fraction_timespec &when, const WindowRef &source, InputModifier mods, PointerType ptype, uint16_t id, jau::math::Vec2i pos, uint16_t clickCount, InputButton button, jau::math::Vec3f rotation, float rotationScale)
Constructor for traditional one-pointer event.
constexpr const std::vector< jau::math::Vec2i > & allPositions() const noexcept
Returns position of all pointers in pixel units.
static jau::math::Vec3f swapRotation(float rotationXorY, InputModifier mods)
Returns the 3-axis XYZ rotation array by given rotation on Y axis or X axis (if InputModifier::shift ...
Listener for PointerEvent.
virtual void pointerDragged(PointerEvent &)
virtual void pointerReleased(PointerEvent &)
virtual void pointerEntered(PointerEvent &)
Only generated for PointerType#Mouse.
virtual ~PointerListener() noexcept=default
virtual void pointerClicked(PointerEvent &)
virtual void pointerExited(PointerEvent &)
Only generated for PointerType#Mouse.
virtual void pointerMoved(PointerEvent &)
virtual void pointerWheelMoved(PointerEvent &)
Traditional event name originally produced by a PointerType::mouse pointer type.
virtual void pointerPressed(PointerEvent &)
constexpr const WindowWeakPtr & source() const noexcept
Definition Event.hpp:85
constexpr const jau::fraction_timespec & when() const noexcept
Definition Event.hpp:84
constexpr uint16_t type() const noexcept
Definition Event.hpp:83
value_type x
Definition vec3f.hpp:69
value_type y
Definition vec3f.hpp:70
std::string to_string(const endian_t v) noexcept
Return std::string representation of the given endian.
constexpr std::underlying_type_t< E > number(const E v) noexcept
#define JAU_MAKE_ENUM_STRING(type,...)
constexpr bool is_set(const E mask, const E bits) noexcept
static constexpr short EVENT_POINTER_WHEEL
Definition Event.hpp:70
static constexpr short EVENT_POINTER_PRESSED
Definition Event.hpp:66
std::shared_ptr< PointerListener > PointerListenerRef
static constexpr short EVENT_POINTER_RELEASED
Definition Event.hpp:67
PointerClass
Class of pointer types.
static constexpr short EVENT_POINTER_CLICKED
Definition Event.hpp:61
constexpr PointerClass getPointerClass(PointerType pt) noexcept
static constexpr short EVENT_POINTER_EXITED
Only generated for PointerType::mouse.
Definition Event.hpp:65
PointerType
Type of pointer devices.
static constexpr short EVENT_POINTER_DRAGGED
Definition Event.hpp:69
std::shared_ptr< Window > WindowRef
Definition Event.hpp:36
static constexpr short EVENT_POINTER_MOVED
Definition Event.hpp:68
static constexpr short EVENT_POINTER_ENTERED
Only generated for PointerType::mouse.
Definition Event.hpp:63
@ offscreen
Desktop compatibility profile.
@ onscreen
Desktop core profile.
@ pen
Pen usually off-screen.
@ touchscreen
Touch screen, fingers on screen.
@ touchpad
Touch pad, fingers off screen.
U castOrThrow(T has)
Definition GampTypes.hpp:70
Vector2I< int > Vec2i
Definition vec2i.hpp:328
Vector3F< float > Vec3f
Definition vec3f.hpp:436
std::string to_string(const math_error_t v) noexcept
Returns std::string representation of math_error_t.
Timespec structure using int64_t for its components in analogy to struct timespec_t on 64-bit platfor...