MyGUI 3.2.2

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

MyGUI_InputManager.h
Go to the documentation of this file.
1 /*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7 #ifndef MYGUI_INPUT_MANAGER_H_
8 #define MYGUI_INPUT_MANAGER_H_
9
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_Macros.h"
12 #include "MyGUI_Singleton.h"
13 #include "MyGUI_WidgetDefines.h"
14 #include "MyGUI_IUnlinkWidget.h"
15 #include "MyGUI_WidgetDefines.h"
16 #include "MyGUI_XmlDocument.h"
17 #include "MyGUI_MouseButton.h"
18 #include "MyGUI_KeyCode.h"
19 #include "MyGUI_Timer.h"
20 #include "MyGUI_ILayer.h"
21 #include "MyGUI_Delegate.h"
22 #include "MyGUI_BackwardCompatibility.h"
23
24 namespace MyGUI
25 {
26
27 class MYGUI_EXPORT InputManager :
28 public Singleton<InputManager>,
29 public IUnlinkWidget,
30 public MemberObsolete<InputManager>
31 {
32 public:
33 InputManager();
34
35 void initialise();
36 void shutdown();
37
41 bool injectMouseMove(int _absx, int _absy, int _absz);
45 bool injectMousePress(int _absx, int _absy, MouseButton _id);
49 bool injectMouseRelease(int _absx, int _absy, MouseButton _id);
50
54 bool injectKeyPress(KeyCode _key, Char _text = 0);
58 bool injectKeyRelease(KeyCode _key);
59
61 bool isFocusMouse() const;
63 bool isFocusKey() const;
65 bool isCaptureMouse() const;
66
68 void setKeyFocusWidget(Widget* _widget);
70 void resetKeyFocusWidget(Widget* _widget);
72 void resetKeyFocusWidget();
73
75 Widget* getMouseFocusWidget() const;
77 Widget* getKeyFocusWidget() const;
78
82 const IntPoint& getLastPressedPosition(MouseButton _id) const;
83
85 const IntPoint& getMousePosition() const;
86
90 IntPoint getMousePositionByLayer();
91
92 // работа с модальными окнами
94 void addWidgetModal(Widget* _widget);
96 void removeWidgetModal(Widget* _widget);
97
99 bool isModalAny() const;
100
102 bool isControlPressed() const;
104 bool isShiftPressed() const;
105
110 void resetMouseCaptureWidget();
111
113 void unlinkWidget(Widget* _widget);
114
119 delegates::CMultiDelegate1<Widget*> eventChangeMouseFocus;
120
125 delegates::CMultiDelegate1<Widget*> eventChangeKeyFocus;
126
127 /*internal:*/
128 void _resetMouseFocusWidget();
129
130 private:
131 // удаляем данный виджет из всех возможных мест
132 void _unlinkWidget(Widget* _widget);
133
134 void frameEntered(float _frame);
135
136 void firstEncoding(KeyCode _key, bool bIsKeyPressed);
137
138 // запоминает клавишу для поддержки повторения
139 void storeKey(KeyCode _key, Char _text);
140
141 // сбрасывает клавишу повторения
142 void resetKey();
143
144 private:
145 // виджеты которым принадлежит фокус
146 Widget* mWidgetMouseFocus;
147 Widget* mWidgetKeyFocus;
148 ILayer* mLayerMouseFocus;
149
150 //used for double click timing
151 float mTimerDoubleClick; // time since the last click
152
153 // нажат ли шифт
154 bool mIsShiftPressed;
155 // нажат ли контрол
156 bool mIsControlPressed;
157
158 IntPoint mMousePosition;
159
160 // last mouse press position
161 IntPoint mLastPressed[MouseButton::MAX];
162
163 // is mouse button captured by active widget
164 bool mMouseCapture[MouseButton::MAX];
165
166 // клавиша для повтора
167 KeyCode mHoldKey;
168 Char mHoldChar;
169 bool mFirstPressKey;
170 float mTimerKey;
171 int mOldAbsZ;
172
173 // список виджетов с модальным режимом
174 VectorWidgetPtr mVectorModalRootWidget;
175
176 bool mIsInitialise;
177 };
178
179 } // namespace MyGUI
180
181 #endif // MYGUI_INPUT_MANAGER_H_
MyGUI::Widget
Widget properties. Widget_skin_childs Skin childs. Widget widget description should be here...
Definition: MyGUI_Widget.h:29
MyGUI_Timer.h
MyGUI_MouseButton.h
MyGUI::types::TPoint< int >
MyGUI::MouseButton::MAX
Definition: MyGUI_MouseButton.h:33
MyGUI_Prerequest.h
MyGUI_Singleton.h
MyGUI::KeyCode
Definition: MyGUI_KeyCode.h:15
MyGUI::InputManager
Definition: MyGUI_InputManager.h:27
MyGUI_Macros.h
MyGUI_WidgetDefines.h
MyGUI::MouseButton
Definition: MyGUI_MouseButton.h:15
MyGUI_XmlDocument.h
MyGUI
Definition: MyGUI_ActionController.h:14
MyGUI::IUnlinkWidget
Definition: MyGUI_IUnlinkWidget.h:16
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:103
MyGUI::ILayer
Definition: MyGUI_ILayer.h:21
MyGUI::VectorWidgetPtr
std::vector< Widget * > VectorWidgetPtr
Definition: MyGUI_WidgetDefines.h:19
MyGUI::Char
unsigned int Char
Definition: MyGUI_Types.h:51
MyGUI_BackwardCompatibility.h
MyGUI_ILayer.h
MyGUI::MemberObsolete
Definition: MyGUI_DeprecatedTypes.h:13
MyGUI::Singleton
Definition: MyGUI_Singleton.h:20
MyGUI_KeyCode.h
MyGUI::InputManager::eventChangeKeyFocus
delegates::CMultiDelegate1< Widget * > eventChangeKeyFocus
Definition: MyGUI_InputManager.h:125
MyGUI_Delegate.h
MyGUI::delegates::CMultiDelegate1< Widget * >
MyGUI_IUnlinkWidget.h
MyGUI::InputManager::eventChangeMouseFocus
delegates::CMultiDelegate1< Widget * > eventChangeMouseFocus
Definition: MyGUI_InputManager.h:119