28 #ifndef CCEGUIEVENTPUSHER_H_INCLUDED
29 #define CCEGUIEVENTPUSHER_H_INCLUDED
31 #include "../../CEGUI.h"
40 gui::ICursorControl* d_cursorctrl;
51 bool OnEvent(
const SEvent& event)
53 switch (event.EventType)
55 case EET_KEY_INPUT_EVENT :
56 if (event.KeyInput.PressedDown)
57 return OnKeyDown(event.KeyInput.Key, event.KeyInput.Char, event.KeyInput.Control, event.KeyInput.Shift);
59 return OnKeyUp(event.KeyInput.Key, event.KeyInput.Char, event.KeyInput.Control, event.KeyInput.Shift);
62 case EET_MOUSE_INPUT_EVENT :
63 return OnMouse(event.MouseInput.X, event.MouseInput.Y, event.MouseInput.Wheel, event.MouseInput.Event);
73 bool OnKeyDown(EKEY_CODE key,
wchar_t wch,
bool ,
bool )
82 bool OnKeyUp(EKEY_CODE key,
wchar_t ,
bool ,
bool )
90 bool OnMouse(s32 x, s32 y, f32 w, EMOUSE_INPUT_EVENT e)
98 case EMIE_LMOUSE_PRESSED_DOWN:
102 case EMIE_RMOUSE_PRESSED_DOWN:
106 case EMIE_MMOUSE_PRESSED_DOWN:
110 case EMIE_LMOUSE_LEFT_UP:
114 case EMIE_RMOUSE_LEFT_UP:
118 case EMIE_MMOUSE_LEFT_UP:
122 case EMIE_MOUSE_MOVED:
124 static_cast<float>(x), static_cast<float>(y));
128 case EMIE_MOUSE_WHEEL:
139 unsigned char irr2ceCODE[irr::KEY_KEY_CODES_COUNT];
144 memset(irr2ceCODE, 0, KEY_KEY_CODES_COUNT);
146 irr2ceCODE[KEY_LBUTTON ] = 0;
147 irr2ceCODE[KEY_RBUTTON ] = 0;
148 irr2ceCODE[KEY_CANCEL ] = 0;
149 irr2ceCODE[KEY_MBUTTON ] = 0;
150 irr2ceCODE[KEY_XBUTTON1 ] = 0;
151 irr2ceCODE[KEY_XBUTTON2 ] = 0;
152 irr2ceCODE[KEY_BACK ] = Key::Backspace;
153 irr2ceCODE[KEY_TAB ] = Key::Tab;
154 irr2ceCODE[KEY_CLEAR ] = 0;
155 irr2ceCODE[KEY_RETURN ] = Key::Return;
156 irr2ceCODE[KEY_SHIFT ] = Key::LeftShift;
157 irr2ceCODE[KEY_CONTROL ] = Key::LeftControl;
158 irr2ceCODE[KEY_MENU ] = Key::LeftAlt;
159 irr2ceCODE[KEY_PAUSE ] = Key::Pause;
160 irr2ceCODE[KEY_CAPITAL ] = Key::Capital;
161 irr2ceCODE[KEY_KANA ] = Key::Kana;
162 irr2ceCODE[KEY_HANGUEL ] = KEY_HANGUEL;
163 irr2ceCODE[KEY_HANGUL ] = KEY_HANGUL;
164 irr2ceCODE[KEY_JUNJA ] = 0;
165 irr2ceCODE[KEY_FINAL ] = 0;
166 irr2ceCODE[KEY_HANJA ] = 0;
167 irr2ceCODE[KEY_KANJI ] = 0;
168 irr2ceCODE[KEY_ESCAPE ] = Key::Escape;
169 irr2ceCODE[KEY_CONVERT ] = Key::Convert;
170 irr2ceCODE[KEY_NONCONVERT] = Key::NoConvert;
171 irr2ceCODE[KEY_ACCEPT ] = 0;
172 irr2ceCODE[KEY_MODECHANGE] = 0;
173 irr2ceCODE[KEY_SPACE ] = Key::Space;
174 irr2ceCODE[KEY_PRIOR ] = Key::PageUp;
175 irr2ceCODE[KEY_NEXT ] = Key::PageDown;
176 irr2ceCODE[KEY_END ] = Key::End;
177 irr2ceCODE[KEY_HOME ] = Key::Home;
178 irr2ceCODE[KEY_LEFT ] = Key::ArrowLeft;
179 irr2ceCODE[KEY_UP ] = Key::ArrowUp;
180 irr2ceCODE[KEY_RIGHT ] = Key::ArrowRight;
181 irr2ceCODE[KEY_DOWN ] = Key::ArrowDown;
182 irr2ceCODE[KEY_SELECT ] = 0;
183 irr2ceCODE[KEY_PRINT ] = Key::SysRq;
184 irr2ceCODE[KEY_EXECUT ] = 0;
185 irr2ceCODE[KEY_SNAPSHOT ] = 0;
186 irr2ceCODE[KEY_INSERT ] = Key::Insert;
187 irr2ceCODE[KEY_DELETE ] = Key::Delete;
188 irr2ceCODE[KEY_HELP ] = 0;
189 irr2ceCODE[KEY_KEY_0 ] = Key::Zero;
190 irr2ceCODE[KEY_KEY_1 ] = Key::One;
191 irr2ceCODE[KEY_KEY_2 ] = Key::Two;
192 irr2ceCODE[KEY_KEY_3 ] = Key::Three;
193 irr2ceCODE[KEY_KEY_4 ] = Key::Four;
194 irr2ceCODE[KEY_KEY_5 ] = Key::Five;
195 irr2ceCODE[KEY_KEY_6 ] = Key::Six;
196 irr2ceCODE[KEY_KEY_7 ] = Key::Seven;
197 irr2ceCODE[KEY_KEY_8 ] = Key::Eight;
198 irr2ceCODE[KEY_KEY_9 ] = Key::Nine;
199 irr2ceCODE[KEY_KEY_A ] = Key::A;
200 irr2ceCODE[KEY_KEY_B ] = Key::B;
201 irr2ceCODE[KEY_KEY_C ] = Key::C;
202 irr2ceCODE[KEY_KEY_D ] = Key::D;
203 irr2ceCODE[KEY_KEY_E ] = Key::E;
204 irr2ceCODE[KEY_KEY_F ] = Key::F;
205 irr2ceCODE[KEY_KEY_G ] = Key::G;
206 irr2ceCODE[KEY_KEY_H ] = Key::H;
207 irr2ceCODE[KEY_KEY_I ] = Key::I;
208 irr2ceCODE[KEY_KEY_J ] = Key::J;
209 irr2ceCODE[KEY_KEY_K ] = Key::K;
210 irr2ceCODE[KEY_KEY_L ] = Key::L;
211 irr2ceCODE[KEY_KEY_M ] = Key::M;
212 irr2ceCODE[KEY_KEY_N ] = Key::N;
213 irr2ceCODE[KEY_KEY_O ] = Key::O;
214 irr2ceCODE[KEY_KEY_P ] = Key::P;
215 irr2ceCODE[KEY_KEY_Q ] = Key::Q;
216 irr2ceCODE[KEY_KEY_R ] = Key::R;
217 irr2ceCODE[KEY_KEY_S ] = Key::S;
218 irr2ceCODE[KEY_KEY_T ] = Key::T;
219 irr2ceCODE[KEY_KEY_U ] = Key::U;
220 irr2ceCODE[KEY_KEY_V ] = Key::V;
221 irr2ceCODE[KEY_KEY_W ] = Key::W;
222 irr2ceCODE[KEY_KEY_X ] = Key::X;
223 irr2ceCODE[KEY_KEY_Y ] = Key::Y;
224 irr2ceCODE[KEY_KEY_Z ] = Key::Z;
225 irr2ceCODE[KEY_LWIN ] = Key::LeftWindows;
226 irr2ceCODE[KEY_RWIN ] = Key::RightWindows;
227 irr2ceCODE[KEY_APPS ] = Key::AppMenu;
228 irr2ceCODE[KEY_SLEEP ] = Key::Sleep;
229 irr2ceCODE[KEY_NUMPAD0 ] = Key::Numpad0;
230 irr2ceCODE[KEY_NUMPAD1 ] = Key::Numpad1;
231 irr2ceCODE[KEY_NUMPAD2 ] = Key::Numpad2;
232 irr2ceCODE[KEY_NUMPAD3 ] = Key::Numpad3;
233 irr2ceCODE[KEY_NUMPAD4 ] = Key::Numpad4;
234 irr2ceCODE[KEY_NUMPAD5 ] = Key::Numpad5;
235 irr2ceCODE[KEY_NUMPAD6 ] = Key::Numpad6;
236 irr2ceCODE[KEY_NUMPAD7 ] = Key::Numpad7;
237 irr2ceCODE[KEY_NUMPAD8 ] = Key::Numpad8;
238 irr2ceCODE[KEY_NUMPAD9 ] = Key::Numpad9;
239 irr2ceCODE[KEY_MULTIPLY ] = Key::Multiply;
240 irr2ceCODE[KEY_ADD ] = Key::Add;
241 irr2ceCODE[KEY_SEPARATOR ] = 0;
242 irr2ceCODE[KEY_SUBTRACT ] = Key::Subtract;
243 irr2ceCODE[KEY_DECIMAL ] = Key::Decimal;
244 irr2ceCODE[KEY_DIVIDE ] = Key::Divide;
245 irr2ceCODE[KEY_F1 ] = Key::F1;
246 irr2ceCODE[KEY_F2 ] = Key::F2;
247 irr2ceCODE[KEY_F3 ] = Key::F3;
248 irr2ceCODE[KEY_F4 ] = Key::F4;
249 irr2ceCODE[KEY_F5 ] = Key::F5;
250 irr2ceCODE[KEY_F6 ] = Key::F6;
251 irr2ceCODE[KEY_F7 ] = Key::F7;
252 irr2ceCODE[KEY_F8 ] = Key::F8;
253 irr2ceCODE[KEY_F9 ] = Key::F9;
254 irr2ceCODE[KEY_F10 ] = Key::F10;
255 irr2ceCODE[KEY_F11 ] = Key::F11;
256 irr2ceCODE[KEY_F12 ] = Key::F12;
257 irr2ceCODE[KEY_F13 ] = Key::F13;
258 irr2ceCODE[KEY_F14 ] = Key::F14;
259 irr2ceCODE[KEY_F15 ] = Key::F15;
260 irr2ceCODE[KEY_F16 ] = 0;
261 irr2ceCODE[KEY_F17 ] = 0;
262 irr2ceCODE[KEY_F18 ] = 0;
263 irr2ceCODE[KEY_F19 ] = 0;
264 irr2ceCODE[KEY_F20 ] = 0;
265 irr2ceCODE[KEY_F21 ] = 0;
266 irr2ceCODE[KEY_F22 ] = 0;
267 irr2ceCODE[KEY_F23 ] = 0;
268 irr2ceCODE[KEY_F24 ] = 0;
269 irr2ceCODE[KEY_NUMLOCK ] = Key::NumLock;
270 irr2ceCODE[KEY_SCROLL ] = Key::ScrollLock;
271 irr2ceCODE[KEY_LSHIFT ] = Key::LeftShift;
272 irr2ceCODE[KEY_RSHIFT ] = Key::RightShift;
273 irr2ceCODE[KEY_LCONTROL ] = Key::LeftControl;
274 irr2ceCODE[KEY_RCONTROL ] = Key::RightControl;
275 irr2ceCODE[KEY_LMENU ] = Key::LeftAlt;
276 irr2ceCODE[KEY_RMENU ] = Key::RightAlt;
277 irr2ceCODE[KEY_COMMA ] = Key::Comma;
278 irr2ceCODE[KEY_PLUS ] = Key::Add;
279 irr2ceCODE[KEY_MINUS ] = Key::Minus;
280 irr2ceCODE[KEY_PERIOD ] = Key::Period;
281 irr2ceCODE[KEY_ATTN ] = 0;
282 irr2ceCODE[KEY_CRSEL ] = 0;
283 irr2ceCODE[KEY_EXSEL ] = 0;
284 irr2ceCODE[KEY_EREOF ] = 0;
285 irr2ceCODE[KEY_PLAY ] = 0;
286 irr2ceCODE[KEY_ZOOM ] = 0;
287 irr2ceCODE[KEY_PA1 ] = 0;
288 irr2ceCODE[KEY_OEM_CLEAR ] = 0;
298 uchar getKeyCode(irr::EKEY_CODE kc)
300 return irr2ceCODE[kc];