MyGUI 3.4.2
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"
23
24namespace MyGUI
25{
26
28 public IUnlinkWidget,
29 public MemberObsolete<InputManager>
30 {
32 public:
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
124
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_
#define MYGUI_EXPORT
#define MYGUI_SINGLETON_DECLARATION(ClassName)
delegates::CMultiDelegate1< Widget * > eventChangeMouseFocus
delegates::CMultiDelegate1< Widget * > eventChangeKeyFocus
widget description should be here.
std::vector< Widget * > VectorWidgetPtr
unsigned int Char
Definition MyGUI_Types.h:50