MyGUI 3.2.0

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

- File List
- Globals

MyGUI_WidgetInput.h
Go to the documentation of this file.
1
6 /*
7 This file is part of MyGUI.
8
9 MyGUI is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 MyGUI is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_WIDGET_INPUT_H__
23 #define __MYGUI_WIDGET_INPUT_H__
24
25 #include "MyGUI_Prerequest.h"
26 #include "MyGUI_Macros.h"
27 #include "MyGUI_WidgetDefines.h"
28 #include "MyGUI_WidgetToolTip.h"
29 #include "MyGUI_MouseButton.h"
30 #include "MyGUI_KeyCode.h"
31 #include "MyGUI_MaskPickInfo.h"
32 #include "MyGUI_Delegate.h"
33 #include "MyGUI_EventPair.h"
34
35 namespace MyGUI
36 {
37
62 // делегаты для событий виджета
63 typedef delegates::CMultiDelegate1<Widget*> EventHandle_WidgetVoid;
64 typedef delegates::CMultiDelegate2<Widget*, Widget*> EventHandle_WidgetWidget;
65 typedef delegates::CMultiDelegate2<Widget*, bool> EventHandle_WidgetBool;
66 typedef delegates::CMultiDelegate2<Widget*, int> EventHandle_WidgetInt;
67 typedef delegates::CMultiDelegate2<Widget*, size_t> EventHandle_WidgetSizeT;
68 typedef delegates::CMultiDelegate3<Widget*, int, int> EventHandle_WidgetIntInt;
69 typedef delegates::CMultiDelegate4<Widget*, int, int, MouseButton> EventHandle_WidgetIntIntButton;
70 typedef delegates::CMultiDelegate2<Widget*, KeyCode> EventHandle_WidgetKeyCode;
71 typedef delegates::CMultiDelegate3<Widget*, KeyCode, Char> EventHandle_WidgetKeyCodeChar;
72 typedef delegates::CMultiDelegate2<Widget*, const ToolTipInfo& > EventHandle_WidgetToolTip;
73
74 class MYGUI_EXPORT WidgetInput
75 {
76 public:
77 WidgetInput();
78 virtual ~WidgetInput();
79
81 void setNeedToolTip(bool _value);
83 bool getNeedToolTip() const;
84
86 void setPointer(const std::string& _value);
88 const std::string& getPointer() const;
89
91 void setNeedKeyFocus(bool _value);
96 bool getNeedKeyFocus() const;
97
99 void setNeedMouseFocus(bool _value);
104 bool getNeedMouseFocus() const;
105
111 void setInheritsPick(bool _value);
113 bool getInheritsPick() const;
114
116 void setMaskPick(const std::string& _filename);
118 void setMaskPick(const MaskPickInfo& _info);
119
120 bool isMaskPickInside(const IntPoint& _point, const IntCoord& _coord) const;
121
122 bool getRootMouseFocus() const;
123 bool getRootKeyFocus() const;
124
130 EventHandle_WidgetWidget
131 eventMouseLostFocus;
132
138 EventHandle_WidgetWidget
139 eventMouseSetFocus;
140
147 EventPair3to4<EventHandle_WidgetIntInt, EventHandle_WidgetIntIntButton>
148 eventMouseDrag;
149
156 EventHandle_WidgetIntInt
157 eventMouseMove;
158
164 EventHandle_WidgetInt
165 eventMouseWheel;
166
174 EventHandle_WidgetIntIntButton
175 eventMouseButtonPressed;
176
184 EventHandle_WidgetIntIntButton
185 eventMouseButtonReleased;
186
191 EventHandle_WidgetVoid
192 eventMouseButtonClick;
193
198 EventHandle_WidgetVoid
199 eventMouseButtonDoubleClick;
200
206 EventHandle_WidgetWidget
207 eventKeyLostFocus;
208
214 EventHandle_WidgetWidget
215 eventKeySetFocus;
216
223 EventHandle_WidgetKeyCodeChar
224 eventKeyButtonPressed;
225
231 EventHandle_WidgetKeyCode
232 eventKeyButtonReleased;
233
240 EventHandle_WidgetBool
241 eventRootMouseChangeFocus;
242
249 EventHandle_WidgetBool
250 eventRootKeyChangeFocus;
251
257 EventHandle_WidgetToolTip
258 eventToolTip;
259
260 /*internal:*/
261 void _riseMouseLostFocus(Widget* _new);
262 void _riseMouseSetFocus(Widget* _old);
263 void _riseMouseDrag(int _left, int _top, MouseButton _id);
264 void _riseMouseMove(int _left, int _top);
265 void _riseMouseWheel(int _rel);
266 void _riseMouseButtonPressed(int _left, int _top, MouseButton _id);
267 void _riseMouseButtonReleased(int _left, int _top, MouseButton _id);
268 void _riseMouseButtonClick();
269 void _riseMouseButtonDoubleClick();
270 void _riseKeyLostFocus(Widget* _new);
271 void _riseKeySetFocus(Widget* _old);
272 void _riseKeyButtonPressed(KeyCode _key, Char _char);
273 void _riseKeyButtonReleased(KeyCode _key);
274 void _riseMouseChangeRootFocus(bool _focus);
275 void _riseKeyChangeRootFocus(bool _focus);
276
277 void _setRootMouseFocus(bool _value);
278 void _setRootKeyFocus(bool _value);
279
280 protected:
281 virtual void onMouseLostFocus(Widget* _new);
282 virtual void onMouseSetFocus(Widget* _old);
283 virtual void onMouseDrag(int _left, int _top, MouseButton _id);
284 virtual void onMouseMove(int _left, int _top);
285 virtual void onMouseWheel(int _rel);
286 virtual void onMouseButtonPressed(int _left, int _top, MouseButton _id);
287 virtual void onMouseButtonReleased(int _left, int _top, MouseButton _id);
288 virtual void onMouseButtonClick();
289 virtual void onMouseButtonDoubleClick();
290 virtual void onKeyLostFocus(Widget* _new);
291 virtual void onKeySetFocus(Widget* _old);
292 virtual void onKeyButtonPressed(KeyCode _key, Char _char);
293 virtual void onKeyButtonReleased(KeyCode _key);
294 virtual void onMouseChangeRootFocus(bool _focus);
295 virtual void onKeyChangeRootFocus(bool _focus);
296
297 private:
298 std::string mPointer;
299 MaskPickInfo mOwnMaskPickInfo;
300
301 bool mNeedToolTip;
302 bool mInheritsPick;
303 bool mNeedKeyFocus;
304 bool mNeedMouseFocus;
305
306 bool mRootMouseFocus;
307 bool mRootKeyFocus;
308 };
309
310 } // namespace MyGUI
311
312 #endif // __MYGUI_WIDGET_INPUT_H__
MyGUI::WidgetInput::eventMouseWheel
EventHandle_WidgetInt eventMouseWheel
Definition: MyGUI_WidgetInput.h:165
MyGUI::types::TCoord< int >
MyGUI::EventHandle_WidgetInt
delegates::CMultiDelegate2< Widget *, int > EventHandle_WidgetInt
Definition: MyGUI_WidgetInput.h:66
MyGUI::EventHandle_WidgetIntIntButton
delegates::CMultiDelegate4< Widget *, int, int, MouseButton > EventHandle_WidgetIntIntButton
Definition: MyGUI_WidgetInput.h:69
MyGUI::Widget
Definition: MyGUI_Widget.h:41
MyGUI_WidgetToolTip.h
MyGUI::EventHandle_WidgetToolTip
delegates::CMultiDelegate2< Widget *, const ToolTipInfo & > EventHandle_WidgetToolTip
Definition: MyGUI_WidgetInput.h:72
MyGUI_MouseButton.h
MyGUI::EventHandle_WidgetKeyCode
delegates::CMultiDelegate2< Widget *, KeyCode > EventHandle_WidgetKeyCode
Definition: MyGUI_WidgetInput.h:70
MyGUI::EventHandle_WidgetBool
delegates::CMultiDelegate2< Widget *, bool > EventHandle_WidgetBool
Definition: MyGUI_WidgetInput.h:65
MyGUI::EventHandle_WidgetKeyCodeChar
delegates::CMultiDelegate3< Widget *, KeyCode, Char > EventHandle_WidgetKeyCodeChar
Definition: MyGUI_WidgetInput.h:71
MyGUI::types::TPoint< int >
MyGUI_Prerequest.h
MyGUI::delegates::CMultiDelegate4< Widget *, int, int, MouseButton >
MyGUI::KeyCode
Definition: MyGUI_KeyCode.h:30
MyGUI::WidgetInput::eventRootKeyChangeFocus
EventHandle_WidgetBool eventRootKeyChangeFocus
Definition: MyGUI_WidgetInput.h:250
MyGUI::WidgetInput::eventMouseButtonClick
EventHandle_WidgetVoid eventMouseButtonClick
Definition: MyGUI_WidgetInput.h:192
MyGUI::WidgetInput::eventMouseButtonReleased
EventHandle_WidgetIntIntButton eventMouseButtonReleased
Definition: MyGUI_WidgetInput.h:185
MyGUI_Macros.h
MyGUI_WidgetDefines.h
MyGUI::WidgetInput::eventRootMouseChangeFocus
EventHandle_WidgetBool eventRootMouseChangeFocus
Definition: MyGUI_WidgetInput.h:241
MyGUI::WidgetInput::eventKeyButtonPressed
EventHandle_WidgetKeyCodeChar eventKeyButtonPressed
Definition: MyGUI_WidgetInput.h:224
MyGUI::delegates::CMultiDelegate3< Widget *, int, int >
MyGUI::EventHandle_WidgetWidget
delegates::CMultiDelegate2< Widget *, Widget * > EventHandle_WidgetWidget
Definition: MyGUI_WidgetInput.h:64
MyGUI::MouseButton
Definition: MyGUI_MouseButton.h:30
MyGUI::WidgetInput
Definition: MyGUI_WidgetInput.h:74
MyGUI::WidgetInput::eventMouseLostFocus
EventHandle_WidgetWidget eventMouseLostFocus
Definition: MyGUI_WidgetInput.h:131
MyGUI::WidgetInput::eventMouseMove
EventHandle_WidgetIntInt eventMouseMove
Definition: MyGUI_WidgetInput.h:157
MyGUI::EventHandle_WidgetVoid
delegates::CMultiDelegate1< Widget * > EventHandle_WidgetVoid
Definition: MyGUI_WidgetInput.h:63
MyGUI::WidgetInput::eventKeySetFocus
EventHandle_WidgetWidget eventKeySetFocus
Definition: MyGUI_WidgetInput.h:215
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:120
MyGUI::EventHandle_WidgetIntInt
delegates::CMultiDelegate3< Widget *, int, int > EventHandle_WidgetIntInt
Definition: MyGUI_WidgetInput.h:68
MyGUI_MaskPickInfo.h
MyGUI::MaskPickInfo
Definition: MyGUI_MaskPickInfo.h:31
MyGUI::Char
unsigned int Char
Definition: MyGUI_Types.h:66
MyGUI::delegates::CMultiDelegate2< Widget *, Widget * >
MyGUI::WidgetInput::eventMouseButtonDoubleClick
EventHandle_WidgetVoid eventMouseButtonDoubleClick
Definition: MyGUI_WidgetInput.h:199
MyGUI::WidgetInput::eventKeyLostFocus
EventHandle_WidgetWidget eventKeyLostFocus
Definition: MyGUI_WidgetInput.h:207
MyGUI::WidgetInput::eventMouseSetFocus
EventHandle_WidgetWidget eventMouseSetFocus
Definition: MyGUI_WidgetInput.h:139
MyGUI_EventPair.h
MyGUI_KeyCode.h
MyGUI::WidgetInput::eventMouseButtonPressed
EventHandle_WidgetIntIntButton eventMouseButtonPressed
Definition: MyGUI_WidgetInput.h:175
MyGUI_Delegate.h
MyGUI::delegates::CMultiDelegate1< Widget * >
MyGUI::WidgetInput::eventMouseDrag
EventPair3to4< EventHandle_WidgetIntInt, EventHandle_WidgetIntIntButton > eventMouseDrag
Definition: MyGUI_WidgetInput.h:148
MyGUI::EventPair3to4
Definition: MyGUI_EventPair.h:145
MyGUI::EventHandle_WidgetSizeT
delegates::CMultiDelegate2< Widget *, size_t > EventHandle_WidgetSizeT
Definition: MyGUI_WidgetInput.h:67
MyGUI::WidgetInput::eventToolTip
EventHandle_WidgetToolTip eventToolTip
Definition: MyGUI_WidgetInput.h:258
MyGUI::WidgetInput::eventKeyButtonReleased
EventHandle_WidgetKeyCode eventKeyButtonReleased
Definition: MyGUI_WidgetInput.h:232