vsg: include/vsg/ui/PointerEvent.h Source File

vsg 1.1.3 VulkanSceneGraph library

Loading...
Searching...
No Matches
PointerEvent.h
1#pragma once
2
3/* <editor-fold desc="MIT License">
4
5Copyright(c) 2018 Robert Osfield
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
9The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
13</editor-fold> */
14
15#include <vsg/app/Window.h>
16#include <vsg/core/observer_ptr.h>
17#include <vsg/ui/WindowEvent.h>
18
19namespace vsg
20{
21
22 enum ButtonMask : uint16_t
23 {
24 BUTTON_MASK_OFF = 0,
25 BUTTON_MASK_1 = 256,
26 BUTTON_MASK_2 = 512,
27 BUTTON_MASK_3 = 1024,
28 BUTTON_MASK_4 = 2048,
29 BUTTON_MASK_5 = 4096
30 };
31
33 class VSG_DECLSPEC PointerEvent : public Inherit<WindowEvent, PointerEvent>
34 {
35 public:
36 PointerEvent() {}
37
38 PointerEvent(Window* in_window, time_point in_time, int32_t in_x, int32_t in_y, ButtonMask in_buttonMask) :
39 Inherit(in_window, in_time),
40 x(in_x),
41 y(in_y),
42 mask(in_buttonMask) {}
43
44 int32_t x = 0;
45 int32_t y = 0;
46 ButtonMask mask = BUTTON_MASK_OFF;
47
48 void read(Input& input) override;
49 void write(Output& output) const override;
50 };
51 VSG_type_name(vsg::PointerEvent);
52
54 class VSG_DECLSPEC ButtonPressEvent : public Inherit<PointerEvent, ButtonPressEvent>
55 {
56 public:
57 ButtonPressEvent() {}
58
59 ButtonPressEvent(Window* in_window, time_point in_time, int32_t in_x, int32_t in_y, ButtonMask in_buttonMask, uint32_t in_button) :
60 Inherit(in_window, in_time, in_x, in_y, in_buttonMask),
61 button(in_button) {}
62
63 uint32_t button = 0;
64
65 void read(Input& input) override;
66 void write(Output& output) const override;
67 };
68 VSG_type_name(vsg::ButtonPressEvent);
69
71 class VSG_DECLSPEC ButtonReleaseEvent : public Inherit<PointerEvent, ButtonReleaseEvent>
72 {
73 public:
74 ButtonReleaseEvent() {}
75
76 ButtonReleaseEvent(Window* in_window, time_point in_time, int32_t in_x, int32_t in_y, ButtonMask in_buttonMask, uint32_t in_button) :
77 Inherit(in_window, in_time, in_x, in_y, in_buttonMask),
78 button(in_button) {}
79
80 uint32_t button = 0;
81
82 void read(Input& input) override;
83 void write(Output& output) const override;
84 };
85 VSG_type_name(vsg::ButtonReleaseEvent);
86
88 class MoveEvent : public Inherit<PointerEvent, MoveEvent>
89 {
90 public:
91 MoveEvent() {}
92
93 MoveEvent(Window* in_window, time_point in_time, int32_t in_x, int32_t in_y, ButtonMask in_buttonMask) :
94 Inherit(in_window, in_time, in_x, in_y, in_buttonMask) {}
95 };
96 VSG_type_name(vsg::MoveEvent);
97
98} // namespace vsg
vsg::ButtonPressEvent
ButtonPressEvent represents a button press event.
Definition PointerEvent.h:55
vsg::ButtonReleaseEvent
ButtonReleaseEvent represents a button release event.
Definition PointerEvent.h:72
vsg::Inherit
Definition Inherit.h:28
vsg::Input
Definition Input.h:44
vsg::MoveEvent
MoveEvent represents a pointer move event.
Definition PointerEvent.h:89
vsg::Output
Definition Output.h:41
vsg::PointerEvent
PointerEvent is a base class for mouse pointer events.
Definition PointerEvent.h:34
vsg::Window
Definition Window.h:31
vsg::allocator_affinity_nodes
std container adapter for allocating with MEMORY_AFFINITY_NODES
Definition Allocator.h:138