OpenLexocad  28.0
EventInterface.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace Core
4 {
5 enum Key
6 {
7  // values are the same as in the Qt (also ASCII),
8  // DON'T CHANGE them
9 
10  KEY_NONE = 0x00,
11  KEY_ESCAPE = 0x01000000,
12  KEY_ENTER = 0x01000005,
13  KEY_RETURN = 0x01000004,
14  KEY_DELETE = 0x01000007,
15 
16  KEY_0 = 0x30,
17  KEY_1 = 0x31,
18  KEY_2 = 0x32,
19  KEY_3 = 0x33,
20  KEY_4 = 0x34,
21  KEY_5 = 0x35,
22  KEY_6 = 0x36,
23  KEY_7 = 0x37,
24  KEY_8 = 0x38,
25  KEY_9 = 0x39,
26  KEY_PLUS = 0x2b,
27  KEY_MINUS = 0x2d,
28 
29  KEY_A = 0x41,
30  KEY_B = 0x42,
31  KEY_C = 0x43,
32  KEY_D = 0x44,
33  KEY_E = 0x45,
34  KEY_F = 0x46,
35  KEY_G = 0x47,
36  KEY_H = 0x48,
37  KEY_I = 0x49,
38  KEY_J = 0x4a,
39  KEY_K = 0x4b,
40  KEY_L = 0x4c,
41  KEY_M = 0x4d,
42  KEY_N = 0x4e,
43  KEY_O = 0x4f,
44  KEY_P = 0x50,
45  KEY_Q = 0x51,
46  KEY_R = 0x52,
47  KEY_S = 0x53,
48  KEY_T = 0x54,
49  KEY_U = 0x55,
50  KEY_V = 0x56,
51  KEY_W = 0x57,
52  KEY_X = 0x58,
53  KEY_Y = 0x59,
54  KEY_Z = 0x5a
55 };
56 
58 {
59  // values are the same as in the Qt,
60  // to make the conversion fast.
61  // DON'T CHANGE them.
62 
63  NONE_BUTTON = 0x00000000,
64  LEFT_BUTTON = 0x00000001,
65  RIGHT_BUTTON = 0x00000002,
66  MIDDLE_BUTTON = 0x00000004
67 };
68 
70 {
71  // DON'T CHANGE
72 
73  NO_MOD = 0x00000000, // No modifier key is pressed.
74  SHIFT = 0x02000000, // A Shift key on the keyboard is pressed.
75  CONTROL = 0x04000000, // A Ctrl key on the keyboard is pressed.
76  ALT = 0x08000000, // An Alt key on the keyboard is pressed.
77  META = 0x10000000, // A Meta key on the keyboard is pressed.
78  KEYPAD = 0x20000000, // A keypad button is pressed.
79  GROUP_SWITCH = 0x40000000 // X11 only. A Mode_switch key on the keyboard is pressed.
80 };
81 
82 
83 
84 struct MouseEvent
85 {
86  int x;
87  int y;
90 
92 
93 
94 
96  {
97  x = 0;
98  y = 0;
101 
102  modifiers = NO_MOD;
103  }
104 
105  MouseEvent(int gx, int gy, int gbutton, int gbuttons, int mods)
106  {
107  x = gx;
108  y = gy;
109  button = (MouseButton)gbutton;
110  buttons = (MouseButton)gbuttons;
112  }
113 };
114 
116 {
117  int value;
118  int x;
119  int y;
120 
122  {
123  value = 0;
124  x = 0;
125  y = 0;
126  }
127 
128  MWheelEvent(int gvalue, int gx, int gy)
129  {
130  value = gvalue;
131  x = gx;
132  y = gy;
133  }
134 };
135 
136 struct KeyEvent
137 {
139 
141 
142  KeyEvent(int gkey) { key = (Key)gkey; }
143 };
144 
146 {
151 
153  {
154  new_width = 0;
155  new_height = 0;
156  old_width = 0;
157  old_height = 0;
158  }
159 
160  ResizeEvent(int wn, int hn, int wo, int ho)
161  {
162  new_width = wn;
163  new_height = hn;
164  old_width = wo;
165  old_height = ho;
166  }
167 };
168 
169 } // namespace Core
Core::KEY_S
@ KEY_S
Definition: EventInterface.h:47
Core::KEY_K
@ KEY_K
Definition: EventInterface.h:39
Core::KEY_H
@ KEY_H
Definition: EventInterface.h:36
Core::KEY_X
@ KEY_X
Definition: EventInterface.h:52
Core::KEY_O
@ KEY_O
Definition: EventInterface.h:43
Core::KEY_ENTER
@ KEY_ENTER
Definition: EventInterface.h:12
Core::ResizeEvent::old_height
int old_height
Definition: EventInterface.h:150
Core::SHIFT
@ SHIFT
Definition: EventInterface.h:74
Core::KEY_I
@ KEY_I
Definition: EventInterface.h:37
Core::KEY_DELETE
@ KEY_DELETE
Definition: EventInterface.h:14
Core::KeyEvent::key
Key key
Definition: EventInterface.h:138
Core::KEY_R
@ KEY_R
Definition: EventInterface.h:46
Core::KEY_N
@ KEY_N
Definition: EventInterface.h:42
Core::MWheelEvent
Definition: EventInterface.h:116
Core::KEYPAD
@ KEYPAD
Definition: EventInterface.h:78
Core::KEY_D
@ KEY_D
Definition: EventInterface.h:32
Core::KeyboardModifiers
KeyboardModifiers
Definition: EventInterface.h:70
Core::ResizeEvent::ResizeEvent
ResizeEvent()
Definition: EventInterface.h:152
Core::KEY_E
@ KEY_E
Definition: EventInterface.h:33
Core::MouseEvent::y
int y
Definition: EventInterface.h:87
Core::KEY_ESCAPE
@ KEY_ESCAPE
Definition: EventInterface.h:11
Core::KEY_P
@ KEY_P
Definition: EventInterface.h:44
Core::MouseEvent::MouseEvent
MouseEvent()
Definition: EventInterface.h:95
Core::KEY_Q
@ KEY_Q
Definition: EventInterface.h:45
Core::MouseButton
MouseButton
Definition: EventInterface.h:58
Core::MouseEvent::modifiers
KeyboardModifiers modifiers
Definition: EventInterface.h:91
Core::MouseEvent::x
int x
Definition: EventInterface.h:86
Core::META
@ META
Definition: EventInterface.h:77
Core::MouseEvent::MouseEvent
MouseEvent(int gx, int gy, int gbutton, int gbuttons, int mods)
Definition: EventInterface.h:105
Core::KEY_J
@ KEY_J
Definition: EventInterface.h:38
Core::KEY_U
@ KEY_U
Definition: EventInterface.h:49
Core::KeyEvent::KeyEvent
KeyEvent()
Definition: EventInterface.h:140
Core::KEY_RETURN
@ KEY_RETURN
Definition: EventInterface.h:13
Core::CONTROL
@ CONTROL
Definition: EventInterface.h:75
Core::ResizeEvent::new_width
int new_width
Definition: EventInterface.h:147
Core::KEY_A
@ KEY_A
Definition: EventInterface.h:29
Core::MouseEvent::button
MouseButton button
Definition: EventInterface.h:89
Core::KEY_3
@ KEY_3
Definition: EventInterface.h:19
Core::KeyEvent::KeyEvent
KeyEvent(int gkey)
Definition: EventInterface.h:142
Core::KeyEvent
Definition: EventInterface.h:137
Core::KEY_V
@ KEY_V
Definition: EventInterface.h:50
Core::LEFT_BUTTON
@ LEFT_BUTTON
Definition: EventInterface.h:64
Core::KEY_Z
@ KEY_Z
Definition: EventInterface.h:54
Core::KEY_M
@ KEY_M
Definition: EventInterface.h:41
Core
Definition: Base.h:5
Core::MouseEvent
Definition: EventInterface.h:85
Core::ALT
@ ALT
Definition: EventInterface.h:76
Core::MWheelEvent::value
int value
Definition: EventInterface.h:117
Core::KEY_5
@ KEY_5
Definition: EventInterface.h:21
Core::KEY_PLUS
@ KEY_PLUS
Definition: EventInterface.h:26
Core::MIDDLE_BUTTON
@ MIDDLE_BUTTON
Definition: EventInterface.h:66
Core::MWheelEvent::x
int x
Definition: EventInterface.h:118
Core::KEY_T
@ KEY_T
Definition: EventInterface.h:48
Core::KEY_C
@ KEY_C
Definition: EventInterface.h:31
Core::KEY_9
@ KEY_9
Definition: EventInterface.h:25
Core::MWheelEvent::MWheelEvent
MWheelEvent(int gvalue, int gx, int gy)
Definition: EventInterface.h:128
Core::KEY_G
@ KEY_G
Definition: EventInterface.h:35
Core::KEY_Y
@ KEY_Y
Definition: EventInterface.h:53
Core::KEY_MINUS
@ KEY_MINUS
Definition: EventInterface.h:27
Core::MouseEvent::buttons
MouseButton buttons
Definition: EventInterface.h:88
Core::MWheelEvent::MWheelEvent
MWheelEvent()
Definition: EventInterface.h:121
Core::KEY_NONE
@ KEY_NONE
Definition: EventInterface.h:10
Core::KEY_F
@ KEY_F
Definition: EventInterface.h:34
Core::KEY_7
@ KEY_7
Definition: EventInterface.h:23
Core::NO_MOD
@ NO_MOD
Definition: EventInterface.h:73
Core::ResizeEvent::ResizeEvent
ResizeEvent(int wn, int hn, int wo, int ho)
Definition: EventInterface.h:160
Core::KEY_W
@ KEY_W
Definition: EventInterface.h:51
Core::MWheelEvent::y
int y
Definition: EventInterface.h:119
Core::RIGHT_BUTTON
@ RIGHT_BUTTON
Definition: EventInterface.h:65
Core::KEY_B
@ KEY_B
Definition: EventInterface.h:30
Core::KEY_0
@ KEY_0
Definition: EventInterface.h:16
Core::NONE_BUTTON
@ NONE_BUTTON
Definition: EventInterface.h:63
Core::KEY_4
@ KEY_4
Definition: EventInterface.h:20
Core::KEY_1
@ KEY_1
Definition: EventInterface.h:17
Core::Key
Key
Definition: EventInterface.h:6
Core::ResizeEvent::old_width
int old_width
Definition: EventInterface.h:149
Core::KEY_8
@ KEY_8
Definition: EventInterface.h:24
Core::KEY_6
@ KEY_6
Definition: EventInterface.h:22
Core::ResizeEvent::new_height
int new_height
Definition: EventInterface.h:148
Core::GROUP_SWITCH
@ GROUP_SWITCH
Definition: EventInterface.h:79
Core::ResizeEvent
Definition: EventInterface.h:146
Core::KEY_L
@ KEY_L
Definition: EventInterface.h:40
Core::KEY_2
@ KEY_2
Definition: EventInterface.h:18