Open3D (C++ API)  0.12.0
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 visualization {
33 namespace gui {
34 
35 enum class MouseButton {
36  NONE = 0,
37  LEFT = (1 << 0),
38  MIDDLE = (1 << 1),
39  RIGHT = (1 << 2),
40  BUTTON4 = (1 << 3),
41  BUTTON5 = (1 << 4)
42 };
43 
44 // The key modifiers are labeled by functionality; for instance,
45 // Ctrl on Windows and Command on macOS have roughly the same functionality.
46 enum class KeyModifier {
47  NONE = 0,
48  SHIFT = (1 << 0),
49  CTRL = (1 << 1), // win/linux: ctrl, macOS: command
50  ALT = (1 << 2), // win/linux: alt, macOS: ctrl
51  META = (1 << 3), // win/linux: windows key, macOS: option
52 };
53 
54 struct MouseEvent {
55  enum Type { MOVE, BUTTON_DOWN, DRAG, BUTTON_UP, WHEEL };
57  int x;
58  int y;
59  int modifiers; // KeyModifiers ORed together
60  union {
61  struct {
62  int buttons; // MouseButtons ORed together
63  } move; // includes drag
64  struct {
66  } button;
67  struct {
68  int dx;
69  int dy;
70  bool isTrackpad;
71  } wheel;
72  };
73 };
74 
75 struct TickEvent {};
76 
77 enum KeyName {
78  KEY_NONE = 0,
80  KEY_TAB = 9,
81  KEY_ENTER = 10,
82  KEY_ESCAPE = 27,
83  KEY_SPACE = 32,
86  KEY_HASH = 35,
94  KEY_PLUS = 43,
95  KEY_COMMA = 44,
96  KEY_MINUS = 45,
97  KEY_PERIOD = 46,
98  KEY_SLASH = 47,
99  KEY_0 = 48,
109  KEY_COLON = 58,
115  KEY_AT = 64,
119  KEY_CARET = 94,
122  KEY_A = 97,
149  KEY_PIPE = 124,
151  KEY_TILDE = 126,
152  KEY_DELETE = 127,
153  KEY_LSHIFT = 256,
169  KEY_UNKNOWN = 1000
170 };
171 
172 struct KeyEvent {
173  enum Type { DOWN, UP };
175  // This is the actual key that was pressed, not the character that
176  // was generated (use TextInputEvent for that). Values correspond
177  // to ASCII values where applicable.
179  bool isRepeat;
180 };
181 
183  const char *utf8;
184 };
185 
186 } // namespace gui
187 } // namespace visualization
188 } // namespace open3d
Definition: Events.h:105
Definition: Events.h:143
Definition: Events.h:136
Definition: Events.h:134
Definition: Events.h:147
uint32_t key
Definition: Events.h:178
Definition: Events.h:123
Type type
Definition: Events.h:56
Definition: Events.h:149
Definition: Events.h:158
MouseButton button
Definition: Events.h:65
int modifiers
Definition: Events.h:59
const char * utf8
Definition: Events.h:183
Definition: Events.h:101
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:557
Definition: Events.h:145
Definition: Events.h:125
Definition: Events.h:160
Definition: Events.h:99
Definition: Events.h:106
Definition: Events.h:140
Definition: Events.h:138
int dx
Definition: Events.h:68
bool isTrackpad
Definition: Events.h:70
Definition: Events.h:130
Definition: Events.h:115
Definition: Events.h:126
Definition: Events.h:137
Definition: Events.h:107
Definition: Events.h:142
int x
Definition: Events.h:57
Definition: Events.h:157
int y
Definition: Events.h:58
Definition: Events.h:162
Definition: Events.h:104
Definition: Events.h:132
Definition: Events.h:124
MouseButton
Definition: Events.h:35
Definition: Events.h:129
Definition: Events.h:108
Definition: Events.h:100
Definition: Events.h:102
Definition: Events.h:141
int buttons
Definition: Events.h:62
KeyModifier
Definition: Events.h:46
Definition: Events.h:139
Definition: PinholeCameraIntrinsic.cpp:35
Definition: Events.h:146
Definition: Events.h:166
Definition: Events.h:103
int dy
Definition: Events.h:69
KeyName
Definition: Events.h:77
bool isRepeat
Definition: Events.h:179
Definition: Events.h:133
Definition: Events.h:131
Definition: Events.h:172
Definition: Events.h:165
Type
Definition: Events.h:173
Definition: Events.h:127
Type type
Definition: Events.h:174
Definition: Events.h:135
Definition: Events.h:128
Definition: Events.h:144
Definition: Events.h:163
Definition: Events.h:122