MyGUI: MyGUI_WidgetInput.h Source File

MyGUI 3.2.2

MyGUI_WidgetInput.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_WIDGET_INPUT_H_
8 #define MYGUI_WIDGET_INPUT_H_
9
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_Macros.h"
12 #include "MyGUI_WidgetDefines.h"
13 #include "MyGUI_WidgetToolTip.h"
14 #include "MyGUI_MouseButton.h"
15 #include "MyGUI_KeyCode.h"
16 #include "MyGUI_MaskPickInfo.h"
17 #include "MyGUI_Delegate.h"
18 #include "MyGUI_EventPair.h"
19
20 namespace MyGUI
21 {
22
47 // делегаты для событий виджета
48 typedef delegates::CMultiDelegate1<Widget*> EventHandle_WidgetVoid;
49 typedef delegates::CMultiDelegate2<Widget*, Widget*> EventHandle_WidgetWidget;
50 typedef delegates::CMultiDelegate2<Widget*, bool> EventHandle_WidgetBool;
51 typedef delegates::CMultiDelegate2<Widget*, int> EventHandle_WidgetInt;
52 typedef delegates::CMultiDelegate2<Widget*, size_t> EventHandle_WidgetSizeT;
53 typedef delegates::CMultiDelegate3<Widget*, int, int> EventHandle_WidgetIntInt;
54 typedef delegates::CMultiDelegate4<Widget*, int, int, MouseButton> EventHandle_WidgetIntIntButton;
55 typedef delegates::CMultiDelegate2<Widget*, KeyCode> EventHandle_WidgetKeyCode;
56 typedef delegates::CMultiDelegate3<Widget*, KeyCode, Char> EventHandle_WidgetKeyCodeChar;
57 typedef delegates::CMultiDelegate2<Widget*, const ToolTipInfo& > EventHandle_WidgetToolTip;
58
59 class MYGUI_EXPORT WidgetInput
60 {
61 public:
62 WidgetInput();
63 virtual ~WidgetInput();
64
66 void setNeedToolTip(bool _value);
68 bool getNeedToolTip() const;
69
71 void setPointer(const std::string& _value);
73 const std::string& getPointer() const;
74
76 void setNeedKeyFocus(bool _value);
81 bool getNeedKeyFocus() const;
82
84 void setNeedMouseFocus(bool _value);
89 bool getNeedMouseFocus() const;
90
96 void setInheritsPick(bool _value);
98 bool getInheritsPick() const;
99
101 void setMaskPick(const std::string& _filename);
103 void setMaskPick(const MaskPickInfo& _info);
104
105 bool isMaskPickInside(const IntPoint& _point, const IntCoord& _coord) const;
106
107 bool getRootMouseFocus() const;
108 bool getRootKeyFocus() const;
109
115 EventHandle_WidgetWidget eventMouseLostFocus;
116
122 EventHandle_WidgetWidget eventMouseSetFocus;
123
130 EventPairAddParameter<EventHandle_WidgetIntInt, EventHandle_WidgetIntIntButton> eventMouseDrag;
131
138 EventHandle_WidgetIntInt eventMouseMove;
139
145 EventHandle_WidgetInt eventMouseWheel;
146
154 EventHandle_WidgetIntIntButton eventMouseButtonPressed;
155
163 EventHandle_WidgetIntIntButton eventMouseButtonReleased;
164
169 EventHandle_WidgetVoid eventMouseButtonClick;
170
175 EventHandle_WidgetVoid eventMouseButtonDoubleClick;
176
182 EventHandle_WidgetWidget eventKeyLostFocus;
183
189 EventHandle_WidgetWidget eventKeySetFocus;
190
197 EventHandle_WidgetKeyCodeChar eventKeyButtonPressed;
198
204 EventHandle_WidgetKeyCode eventKeyButtonReleased;
205
212 EventHandle_WidgetBool eventRootMouseChangeFocus;
213
220 EventHandle_WidgetBool eventRootKeyChangeFocus;
221
227 EventHandle_WidgetToolTip eventToolTip;
228
229 /*internal:*/
230 void _riseMouseLostFocus(Widget* _new);
231 void _riseMouseSetFocus(Widget* _old);
232 void _riseMouseDrag(int _left, int _top, MouseButton _id);
233 void _riseMouseMove(int _left, int _top);
234 void _riseMouseWheel(int _rel);
235 void _riseMouseButtonPressed(int _left, int _top, MouseButton _id);
236 void _riseMouseButtonReleased(int _left, int _top, MouseButton _id);
237 void _riseMouseButtonClick();
238 void _riseMouseButtonDoubleClick();
239 void _riseKeyLostFocus(Widget* _new);
240 void _riseKeySetFocus(Widget* _old);
241 void _riseKeyButtonPressed(KeyCode _key, Char _char);
242 void _riseKeyButtonReleased(KeyCode _key);
243 void _riseMouseChangeRootFocus(bool _focus);
244 void _riseKeyChangeRootFocus(bool _focus);
245
246 void _setRootMouseFocus(bool _value);
247 void _setRootKeyFocus(bool _value);
248
249 protected:
250 virtual void onMouseLostFocus(Widget* _new);
251 virtual void onMouseSetFocus(Widget* _old);
252 virtual void onMouseDrag(int _left, int _top, MouseButton _id);
253 virtual void onMouseMove(int _left, int _top);
254 virtual void onMouseWheel(int _rel);
255 virtual void onMouseButtonPressed(int _left, int _top, MouseButton _id);
256 virtual void onMouseButtonReleased(int _left, int _top, MouseButton _id);
257 virtual void onMouseButtonClick();
258 virtual void onMouseButtonDoubleClick();
259 virtual void onKeyLostFocus(Widget* _new);
260 virtual void onKeySetFocus(Widget* _old);
261 virtual void onKeyButtonPressed(KeyCode _key, Char _char);
262 virtual void onKeyButtonReleased(KeyCode _key);
263 virtual void onMouseChangeRootFocus(bool _focus);
264 virtual void onKeyChangeRootFocus(bool _focus);
265
266 private:
267 std::string mPointer;
268 MaskPickInfo mOwnMaskPickInfo;
269
270 bool mNeedToolTip;
271 bool mInheritsPick;
272 bool mNeedKeyFocus;
273 bool mNeedMouseFocus;
274
275 bool mRootMouseFocus;
276 bool mRootKeyFocus;
277 };
278
279 } // namespace MyGUI
280
281 #endif // MYGUI_WIDGET_INPUT_H_
MyGUI::WidgetInput::eventMouseButtonReleased
EventHandle_WidgetIntIntButton eventMouseButtonReleased
Definition: MyGUI_WidgetInput.h:163
MyGUI::WidgetInput::eventMouseButtonPressed
EventHandle_WidgetIntIntButton eventMouseButtonPressed
Definition: MyGUI_WidgetInput.h:154
MyGUI::EventHandle_WidgetToolTip
delegates::CMultiDelegate2< Widget *, const ToolTipInfo & > EventHandle_WidgetToolTip
Definition: MyGUI_WidgetInput.h:57
MyGUI::WidgetInput
Definition: MyGUI_WidgetInput.h:59
MyGUI_Delegate.h
MyGUI::WidgetInput::eventToolTip
EventHandle_WidgetToolTip eventToolTip
Definition: MyGUI_WidgetInput.h:227
MyGUI::EventHandle_WidgetBool
delegates::CMultiDelegate2< Widget *, bool > EventHandle_WidgetBool
Definition: MyGUI_WidgetInput.h:50
MyGUI::WidgetInput::eventKeyButtonReleased
EventHandle_WidgetKeyCode eventKeyButtonReleased
Definition: MyGUI_WidgetInput.h:204
MyGUI::WidgetInput::eventKeyButtonPressed
EventHandle_WidgetKeyCodeChar eventKeyButtonPressed
Definition: MyGUI_WidgetInput.h:197
MyGUI::EventHandle_WidgetIntIntButton
delegates::CMultiDelegate4< Widget *, int, int, MouseButton > EventHandle_WidgetIntIntButton
Definition: MyGUI_WidgetInput.h:54
MyGUI_KeyCode.h
MyGUI_EventPair.h
MyGUI::EventPairAddParameter< EventHandle_WidgetIntInt, EventHandle_WidgetIntIntButton >
MyGUI::WidgetInput::eventRootMouseChangeFocus
EventHandle_WidgetBool eventRootMouseChangeFocus
Definition: MyGUI_WidgetInput.h:212
MyGUI::Widget
Widget properties. Skin childs. Widget widget description should be here.
Definition: MyGUI_Widget.h:29
MyGUI::WidgetInput::eventMouseLostFocus
EventHandle_WidgetWidget eventMouseLostFocus
Definition: MyGUI_WidgetInput.h:115
MyGUI::types::TPoint< int >
MyGUI::EventHandle_WidgetIntInt
delegates::CMultiDelegate3< Widget *, int, int > EventHandle_WidgetIntInt
Definition: MyGUI_WidgetInput.h:53
MyGUI_MaskPickInfo.h
MyGUI_MouseButton.h
MyGUI::WidgetInput::eventRootKeyChangeFocus
EventHandle_WidgetBool eventRootKeyChangeFocus
Definition: MyGUI_WidgetInput.h:220
MyGUI::MaskPickInfo
Definition: MyGUI_MaskPickInfo.h:16
MyGUI::WidgetInput::eventMouseMove
EventHandle_WidgetIntInt eventMouseMove
Definition: MyGUI_WidgetInput.h:138
MyGUI::MouseButton
Definition: MyGUI_MouseButton.h:15
MyGUI::EventHandle_WidgetVoid
delegates::CMultiDelegate1< Widget * > EventHandle_WidgetVoid
Definition: MyGUI_WidgetInput.h:48
MyGUI_Prerequest.h
MyGUI::EventHandle_WidgetSizeT
delegates::CMultiDelegate2< Widget *, size_t > EventHandle_WidgetSizeT
Definition: MyGUI_WidgetInput.h:52
MyGUI::WidgetInput::eventMouseDrag
EventPairAddParameter< EventHandle_WidgetIntInt, EventHandle_WidgetIntIntButton > eventMouseDrag
Definition: MyGUI_WidgetInput.h:130
MyGUI::EventHandle_WidgetInt
delegates::CMultiDelegate2< Widget *, int > EventHandle_WidgetInt
Definition: MyGUI_WidgetInput.h:51
MyGUI::EventHandle_WidgetKeyCodeChar
delegates::CMultiDelegate3< Widget *, KeyCode, Char > EventHandle_WidgetKeyCodeChar
Definition: MyGUI_WidgetInput.h:56
MyGUI_WidgetToolTip.h
MyGUI::WidgetInput::eventKeySetFocus
EventHandle_WidgetWidget eventKeySetFocus
Definition: MyGUI_WidgetInput.h:189
MyGUI::EventHandle_WidgetKeyCode
delegates::CMultiDelegate2< Widget *, KeyCode > EventHandle_WidgetKeyCode
Definition: MyGUI_WidgetInput.h:55
MyGUI::WidgetInput::eventKeyLostFocus
EventHandle_WidgetWidget eventKeyLostFocus
Definition: MyGUI_WidgetInput.h:182
MyGUI_WidgetDefines.h
MyGUI::EventHandle_WidgetWidget
delegates::CMultiDelegate2< Widget *, Widget * > EventHandle_WidgetWidget
Definition: MyGUI_WidgetInput.h:49
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:103
MyGUI::Char
unsigned int Char
Definition: MyGUI_Types.h:51
MyGUI::WidgetInput::eventMouseSetFocus
EventHandle_WidgetWidget eventMouseSetFocus
Definition: MyGUI_WidgetInput.h:122
MyGUI::WidgetInput::eventMouseButtonDoubleClick
EventHandle_WidgetVoid eventMouseButtonDoubleClick
Definition: MyGUI_WidgetInput.h:175
MyGUI::types::TCoord< int >
MyGUI_Macros.h
MyGUI::WidgetInput::eventMouseWheel
EventHandle_WidgetInt eventMouseWheel
Definition: MyGUI_WidgetInput.h:145
MyGUI
Definition: MyGUI_ActionController.h:14
MyGUI::KeyCode
Definition: MyGUI_KeyCode.h:15
MyGUI::WidgetInput::eventMouseButtonClick
EventHandle_WidgetVoid eventMouseButtonClick
Definition: MyGUI_WidgetInput.h:169