MyGUI: MyGUI_InputManager.h Source File

MyGUI 3.4.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
24namespace MyGUI
25{
26
27 class MYGUI_EXPORT InputManager :
28 public IUnlinkWidget,
29 public MemberObsolete<InputManager>
30 {
31 MYGUI_SINGLETON_DECLARATION(InputManager);
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() const;
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;
106 bool isAltPressed() const;
108 bool isMetaPressed() const;
109
114 void resetMouseCaptureWidget();
115
117 void unlinkWidget(Widget* _widget);
118
123 delegates::CMultiDelegate1<Widget*> eventChangeMouseFocus;
124
129 delegates::CMultiDelegate1<Widget*> eventChangeKeyFocus;
130
131 /*internal:*/
132 void _resetMouseFocusWidget();
133
134 private:
135 // удаляем данный виджет из всех возможных мест
136 void _unlinkWidget(Widget* _widget) override;
137
138 void frameEntered(float _frame);
139
140 void firstEncoding(KeyCode _key, bool bIsKeyPressed);
141
142 // запоминает клавишу для поддержки повторения
143 void storeKey(KeyCode _key, Char _text);
144
145 // сбрасывает клавишу повторения
146 void resetKey();
147
148 private:
149 // виджеты которым принадлежит фокус
150 Widget* mWidgetMouseFocus;
151 Widget* mWidgetKeyFocus;
152 ILayer* mLayerMouseFocus;
153
154 //used for double click timing
155 float mTimerDoubleClick; // time since the last click
156
157 // нажат ли шифт
158 bool mIsShiftPressed;
159 // нажат ли контрол
160 bool mIsControlPressed;
161 bool mIsAltPressed;
162 bool mIsMetaPressed;
163
164 IntPoint mMousePosition;
165
166 // last mouse press position (in Layer coordinates).
167 IntPoint mLastPressed[MouseButton::MAX];
168
169 // is mouse button captured by active widget
170 bool mMouseCapture[MouseButton::MAX];
171
172 // клавиша для повтора
173 KeyCode mHoldKey;
174 Char mHoldChar;
175 bool mFirstPressKey;
176 float mTimerKey;
177 int mOldAbsZ;
178
179 // список виджетов с модальным режимом
180 VectorWidgetPtr mVectorModalRootWidget;
181
182 bool mIsInitialise;
183 };
184
185} // namespace MyGUI
186
187#endif // MYGUI_INPUT_MANAGER_H_
MyGUI_BackwardCompatibility.h
MyGUI_Delegate.h
MyGUI_ILayer.h
MyGUI_IUnlinkWidget.h
MyGUI_KeyCode.h
MyGUI_Macros.h
MyGUI_MouseButton.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MyGUI_Singleton.h
MYGUI_SINGLETON_DECLARATION
#define MYGUI_SINGLETON_DECLARATION(ClassName)
Definition MyGUI_Singleton.h:111
MyGUI_Timer.h
MyGUI_WidgetDefines.h
MyGUI_XmlDocument.h
MyGUI::ILayer
Definition MyGUI_ILayer.h:23
MyGUI::IUnlinkWidget
Definition MyGUI_IUnlinkWidget.h:17
MyGUI::InputManager
Definition MyGUI_InputManager.h:30
MyGUI::InputManager::eventChangeMouseFocus
delegates::CMultiDelegate1< Widget * > eventChangeMouseFocus
Definition MyGUI_InputManager.h:123
MyGUI::InputManager::eventChangeKeyFocus
delegates::CMultiDelegate1< Widget * > eventChangeKeyFocus
Definition MyGUI_InputManager.h:129
MyGUI::MemberObsolete
Definition MyGUI_DeprecatedTypes.h:14
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:37
MyGUI::delegates::MultiDelegate
Definition MyGUI_Delegate.h:200
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::Char
unsigned int Char
Definition MyGUI_Types.h:50
MyGUI::VectorWidgetPtr
std::vector< Widget * > VectorWidgetPtr
Definition MyGUI_WidgetDefines.h:20
MyGUI::KeyCode
Definition MyGUI_KeyCode.h:16
MyGUI::MouseButton
Definition MyGUI_MouseButton.h:16
MyGUI::types::TPoint< int >