Open3D (C++ API)
Events.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 #include <cstdint>
30 
31 namespace open3d {
32 namespace gui {
33 
34 enum class MouseButton {
35  NONE = 0,
36  LEFT = (1 << 0),
37  MIDDLE = (1 << 1),
38  RIGHT = (1 << 2),
39  BUTTON4 = (1 << 3),
40  BUTTON5 = (1 << 4)
41 };
42 
43 // The key modifiers are labeled by functionality; for instance,
44 // Ctrl on Windows and Command on macOS have roughly the samee functionality.
45 enum class KeyModifier {
46  NONE = 0,
47  SHIFT = (1 << 0),
48  CTRL = (1 << 1), // win/linux: ctrl, macOS: command
49  ALT = (1 << 2), // win/linux: alt, macOS: ctrl
50  META = (1 << 3), // win/linux: windows key, macOS: option
51 };
52 
53 struct MouseEvent {
54  enum Type { MOVE, BUTTON_DOWN, DRAG, BUTTON_UP, WHEEL };
56  int x;
57  int y;
58  int modifiers; // KeyModifiers ORed together
59  union {
60  struct {
61  int buttons; // MouseButtons ORed together
62  } move; // includes drag
63  struct {
65  } button;
66  struct {
67  int dx;
68  int dy;
69  bool isTrackpad;
70  } wheel;
71  };
72 };
73 
74 struct TickEvent {};
75 
76 enum KeyName {
77  KEY_NONE = 0,
79  KEY_TAB = 9,
80  KEY_ENTER = 10,
81  KEY_ESCAPE = 27,
82  KEY_SPACE = 32,
85  KEY_HASH = 35,
93  KEY_PLUS = 43,
94  KEY_COMMA = 44,
95  KEY_MINUS = 45,
96  KEY_PERIOD = 46,
97  KEY_SLASH = 47,
98  KEY_0 = 48,
108  KEY_COLON = 58,
114  KEY_AT = 64,
118  KEY_CARET = 94,
121  KEY_A = 97,
148  KEY_PIPE = 124,
150  KEY_TILDE = 126,
151  KEY_DELETE = 127,
152  KEY_LSHIFT = 256,
168  KEY_UNKNOWN = 1000
169 };
170 
171 struct KeyEvent {
172  enum Type { DOWN, UP };
174  // This is the actual key that was pressed, not the character that
175  // was generated (use TextInputEvent for that). Values correspond
176  // to ASCII values where applicable.
178  bool isRepeat;
179 };
180 
182  const char *utf8;
183 };
184 
185 } // namespace gui
186 } // namespace open3d
Definition: Events.h:135
Definition: Events.h:149
int modifiers
Definition: Events.h:58
Definition: Events.h:120
Definition: Events.h:88
Definition: Events.h:171
Definition: Events.h:121
Definition: Events.h:150
Definition: Events.h:103
Definition: Events.h:164
Definition: Events.h:168
Definition: Events.h:143
int dy
Definition: Events.h:68
Definition: Events.h:139
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t timeout_in_ms capture_handle capture_handle capture_handle image_handle temperature_c k4a_image_t image_handle uint8_t image_handle image_handle image_handle image_handle uint32_t
Definition: K4aPlugin.cpp:553
Definition: Events.h:151
Definition: Events.h:160
Definition: Events.h:152
Definition: Events.h:167
bool isTrackpad
Definition: Events.h:69
Definition: Events.h:133
Definition: Events.h:80
Definition: Events.h:146
Type type
Definition: Events.h:55
Definition: Events.h:129
Definition: Events.h:119
Definition: Events.h:89
const char * utf8
Definition: Events.h:182
Definition: Events.h:156
Definition: Events.h:100
Definition: Events.h:134
Definition: Events.h:95
Definition: Events.h:140
Definition: Events.h:113
Definition: Events.h:86
Definition: Events.h:136
Definition: Events.h:106
int x
Definition: Events.h:56
Definition: Events.h:109
Definition: Events.h:127
Definition: Events.h:97
Definition: Events.h:118
Definition: Events.h:99
Definition: Events.h:131
Definition: Events.h:157
Definition: Events.h:105
Definition: Events.h:132
Definition: Events.h:108
Definition: Events.h:107
Definition: Events.h:82
Definition: Events.h:81
Definition: Events.h:102
Definition: Events.h:163
Definition: Events.h:104
Definition: Events.h:74
Definition: Events.h:165
Definition: Events.h:138
Definition: Events.h:112
Type
Definition: Events.h:172
Definition: Events.h:84
Definition: Events.h:79
Definition: Events.h:155
Definition: Events.h:124
Definition: Events.h:153
Definition: Events.h:148
Definition: Events.h:181
KeyName
Definition: Events.h:76
Definition: Events.h:137
Definition: Events.h:98
Definition: Events.h:78
Definition: Events.h:123
Definition: Events.h:53
Definition: Events.h:111
Definition: Open3DViewer.h:29
Type
Definition: Events.h:54
Definition: Events.h:144
Definition: Events.h:83
Definition: Events.h:142
Definition: Events.h:128
int dx
Definition: Events.h:67
Definition: Events.h:162
Definition: Events.h:110
Definition: Events.h:85
KeyModifier
Definition: Events.h:45
Definition: Events.h:154
MouseButton
Definition: Events.h:34
Definition: Events.h:96
Definition: Events.h:122
Definition: Events.h:141
Definition: Events.h:159
uint32_t key
Definition: Events.h:177
MouseButton button
Definition: Events.h:64
Definition: Events.h:158
Definition: Events.h:87
Definition: Events.h:92
int y
Definition: Events.h:57
Definition: Events.h:101
Definition: Events.h:161
Definition: Events.h:130
Definition: Events.h:91
Definition: Events.h:114
Definition: Events.h:116
Definition: Events.h:77
int buttons
Definition: Events.h:61
Definition: Events.h:145
Definition: Events.h:93
Type type
Definition: Events.h:173
Definition: Events.h:166
bool isRepeat
Definition: Events.h:178
Definition: Events.h:126
Definition: Events.h:115
Definition: Events.h:94
Definition: Events.h:125
Definition: Events.h:90
Definition: Events.h:147
Definition: Events.h:117