MyGUI 3.4.1
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;
105
110 void resetMouseCaptureWidget();
111
113 void unlinkWidget(Widget* _widget);
114
120
126
127 /*internal:*/
128 void _resetMouseFocusWidget();
129
130 private:
131 // удаляем данный виджет из всех возможных мест
132 void _unlinkWidget(Widget* _widget) override;
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 (in Layer coordinates).
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_
#define MYGUI_EXPORT
#define MYGUI_SINGLETON_DECLARATION(ClassName)
delegates::CMultiDelegate1< Widget * > eventChangeMouseFocus
delegates::CMultiDelegate1< Widget * > eventChangeKeyFocus
widget description should be here.
Definition: MyGUI_Widget.h:37
std::vector< Widget * > VectorWidgetPtr
unsigned int Char
Definition: MyGUI_Types.h:49