1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 * Declares EventMgr, class distributing events from input devices to GUI windows
24 * @author The GemRB Project
34 #include "WindowMgr.h"
39 #define GEM_RIGHT 0x82
42 #define GEM_DELETE 0x85
43 #define GEM_RETURN 0x86
44 #define GEM_BACKSP 0x87
49 #define GEM_ESCAPE 0x8c
51 #define GEM_PGDOWN 0x8e
55 #define GEM_MOD_SHIFT 1
56 #define GEM_MOD_CTRL 2
59 #define GEM_MOUSEOUT 128
62 #define GEM_MB_ACTION 1
64 #define GEM_MB_SCRLUP 8
65 #define GEM_MB_SCRLDOWN 16
67 #define GEM_MB_NORMAL 255
68 #define GEM_MB_DOUBLECLICK 256
70 #define GEM_RK_DOUBLESPEED 1
71 #define GEM_RK_DISABLE 2
72 #define GEM_RK_QUADRUPLESPEED 4
76 * Class distributing events from input devices to GUI windows.
77 * The events are pumped into instance of this class from a Video driver plugin
80 class GEM_EXPORT EventMgr
{
82 std::vector
< Window
*> windows
;
83 std::vector
< int> topwin
;
85 unsigned short dc_x
, dc_y
;
86 unsigned long dc_time
, dc_delay
;
87 unsigned long rk_delay
, rk_flags
;
91 /** Adds a Window to the Event Manager */
92 void AddWindow(Window
* win
);
93 /** Removes a Window from the Event chain */
94 //void DelWindow(unsigned short WindowID, const char *WindowPack);
95 void DelWindow(Window
* win
);
96 /** Frees and Removes all the Windows in the Array */
98 /** Call this to change the cursor (moving over windows will change it back) */
99 void RefreshCursor(int idx
);
100 /** BroadCast Mouse Move Event */
101 void MouseMove(unsigned short x
, unsigned short y
);
102 /** BroadCast Mouse Move Event */
103 void MouseDown(unsigned short x
, unsigned short y
, unsigned short Button
,
105 /** BroadCast Mouse Move Event */
106 void MouseUp(unsigned short x
, unsigned short y
, unsigned short Button
,
108 /** BroadCast Mouse Idle Event */
109 void MouseIdle(unsigned long time
);
110 /** BroadCast Key Press Event */
111 void KeyPress(unsigned char Key
, unsigned short Mod
);
112 /** BroadCast Key Release Event */
113 void KeyRelease(unsigned char Key
, unsigned short Mod
);
114 /** Special Ket Press Event */
115 void OnSpecialKeyPress(unsigned char Key
);
116 /** Sets focus to the control of the window */
117 void SetFocused(Window
*win
, Control
*ctrl
);
118 /** Sets mouse event focus to the control of the window */
119 void SetMouseFocused(Window
*win
, Control
*ctrl
);
120 /** Sets the maximum accepted doubleclick delay */
121 void SetDCDelay(unsigned long t
);
122 void SetRKDelay(unsigned long t
);
123 unsigned long GetRKDelay();
124 unsigned long SetRKFlags(unsigned long arg
, unsigned int op
);
126 /** Mask of which Mouse Buttons are pressed */
127 unsigned char MButtons
;
129 /** Last Window focused */
130 Window
* last_win_focused
;
131 /** Last Window mouse event focused */
132 Window
* last_win_mousefocused
;
133 /** Last Window under Mouse Pointer*/
134 Window
* last_win_over
;
135 /** Sets a Window on the Top of the Window Queue */
136 void SetDefaultFocus(Window
*win
);
137 void SetOnTop(int Index
);
138 bool ClickMatch(unsigned short x
, unsigned short y
, unsigned long thisTime
);
141 #endif // ! EVENTMGR_H