MyGUI: MyGUI_WidgetInput.h Source File

MyGUI 3.4.3

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
20namespace MyGUI
21{
22
46
47 // делегаты для событий виджета
48 using EventHandle_WidgetVoid = delegates::MultiDelegate<Widget*>;
49 using EventHandle_WidgetWidget = delegates::MultiDelegate<Widget*, Widget*>;
50 using EventHandle_WidgetBool = delegates::MultiDelegate<Widget*, bool>;
51 using EventHandle_WidgetInt = delegates::MultiDelegate<Widget*, int>;
52 using EventHandle_WidgetSizeT = delegates::MultiDelegate<Widget*, size_t>;
53 using EventHandle_WidgetIntInt = delegates::MultiDelegate<Widget*, int, int>;
54 using EventHandle_WidgetIntIntButton = delegates::MultiDelegate<Widget*, int, int, MouseButton>;
55 using EventHandle_WidgetKeyCode = delegates::MultiDelegate<Widget*, KeyCode>;
56 using EventHandle_WidgetKeyCodeChar = delegates::MultiDelegate<Widget*, KeyCode, Char>;
57 using EventHandle_WidgetToolTip = delegates::MultiDelegate<Widget*, const ToolTipInfo&>;
58
59 class MYGUI_EXPORT WidgetInput
60 {
61 public:
62 virtual ~WidgetInput() = default;
63
65 void setNeedToolTip(bool _value);
67 bool getNeedToolTip() const;
68
70 void setPointer(std::string_view _value);
72 const std::string& getPointer() const;
73
75 void setNeedKeyFocus(bool _value);
80 bool getNeedKeyFocus() const;
81
83 void setNeedMouseFocus(bool _value);
88 bool getNeedMouseFocus() const;
89
95 void setInheritsPick(bool _value);
97 bool getInheritsPick() const;
98
100 void setMaskPick(const std::string& _filename);
102 void setMaskPick(const MaskPickInfo& _info);
103
104 bool isMaskPickInside(const IntPoint& _point, const IntCoord& _coord) const;
105
106 bool getRootMouseFocus() const;
107 bool getRootKeyFocus() const;
108
114 EventHandle_WidgetWidget eventMouseLostFocus;
115
121 EventHandle_WidgetWidget eventMouseSetFocus;
122
129 EventPairAddParameter<EventHandle_WidgetIntInt, EventHandle_WidgetIntIntButton> eventMouseDrag;
130
137 EventHandle_WidgetIntInt eventMouseMove;
138
144 EventHandle_WidgetInt eventMouseWheel;
145
153 EventHandle_WidgetIntIntButton eventMouseButtonPressed;
154
162 EventHandle_WidgetIntIntButton eventMouseButtonReleased;
163
168 EventHandle_WidgetVoid eventMouseButtonClick;
169
174 EventHandle_WidgetVoid eventMouseButtonDoubleClick;
175
181 EventHandle_WidgetWidget eventKeyLostFocus;
182
188 EventHandle_WidgetWidget eventKeySetFocus;
189
196 EventHandle_WidgetKeyCodeChar eventKeyButtonPressed;
197
203 EventHandle_WidgetKeyCode eventKeyButtonReleased;
204
211 EventHandle_WidgetBool eventRootMouseChangeFocus;
212
219 EventHandle_WidgetBool eventRootKeyChangeFocus;
220
226 EventHandle_WidgetToolTip eventToolTip;
227
228 /*internal:*/
229 void _riseMouseLostFocus(Widget* _new);
230 void _riseMouseSetFocus(Widget* _old);
231 void _riseMouseDrag(int _left, int _top, MouseButton _id);
232 void _riseMouseMove(int _left, int _top);
233 void _riseMouseWheel(int _rel);
234 void _riseMouseButtonPressed(int _left, int _top, MouseButton _id);
235 void _riseMouseButtonReleased(int _left, int _top, MouseButton _id);
236 void _riseMouseButtonClick();
237 void _riseMouseButtonDoubleClick();
238 void _riseKeyLostFocus(Widget* _new);
239 void _riseKeySetFocus(Widget* _old);
240 void _riseKeyButtonPressed(KeyCode _key, Char _char);
241 void _riseKeyButtonReleased(KeyCode _key);
242 void _riseMouseChangeRootFocus(bool _focus);
243 void _riseKeyChangeRootFocus(bool _focus);
244
245 void _setRootMouseFocus(bool _value);
246 void _setRootKeyFocus(bool _value);
247
248 protected:
249 virtual void onMouseLostFocus(Widget* _new);
250 virtual void onMouseSetFocus(Widget* _old);
251 virtual void onMouseDrag(int _left, int _top, MouseButton _id);
252 virtual void onMouseMove(int _left, int _top);
253 virtual void onMouseWheel(int _rel);
254 virtual void onMouseButtonPressed(int _left, int _top, MouseButton _id);
255 virtual void onMouseButtonReleased(int _left, int _top, MouseButton _id);
256 virtual void onMouseButtonClick();
257 virtual void onMouseButtonDoubleClick();
258 virtual void onKeyLostFocus(Widget* _new);
259 virtual void onKeySetFocus(Widget* _old);
260 virtual void onKeyButtonPressed(KeyCode _key, Char _char);
261 virtual void onKeyButtonReleased(KeyCode _key);
262 virtual void onMouseChangeRootFocus(bool _focus);
263 virtual void onKeyChangeRootFocus(bool _focus);
264
265 private:
266 std::string mPointer;
267 MaskPickInfo mOwnMaskPickInfo;
268
269 bool mNeedToolTip{false};
270 bool mInheritsPick{false};
271 bool mNeedKeyFocus{false};
272 bool mNeedMouseFocus{true};
273
274 bool mRootMouseFocus{false};
275 bool mRootKeyFocus{false};
276 };
277
278} // namespace MyGUI
279
280#endif // MYGUI_WIDGET_INPUT_H_
MyGUI_Delegate.h
MyGUI_EventPair.h
MyGUI_KeyCode.h
MyGUI_Macros.h
MyGUI_MaskPickInfo.h
MyGUI_MouseButton.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MyGUI_WidgetDefines.h
MyGUI_WidgetToolTip.h
MyGUI::EventPairAddParameter
Definition MyGUI_EventPair.h:176
MyGUI::MaskPickInfo
Definition MyGUI_MaskPickInfo.h:17
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:40
MyGUI::WidgetInput
Definition MyGUI_WidgetInput.h:60
MyGUI::WidgetInput::_riseMouseMove
void _riseMouseMove(int _left, int _top)
Definition MyGUI_WidgetInput.cpp:50
MyGUI::WidgetInput::eventMouseButtonDoubleClick
EventHandle_WidgetVoid eventMouseButtonDoubleClick
Definition MyGUI_WidgetInput.h:174
MyGUI::WidgetInput::eventMouseButtonClick
EventHandle_WidgetVoid eventMouseButtonClick
Definition MyGUI_WidgetInput.h:168
MyGUI::WidgetInput::getRootKeyFocus
bool getRootKeyFocus() const
Definition MyGUI_WidgetInput.cpp:177
MyGUI::WidgetInput::_riseMouseButtonDoubleClick
void _riseMouseButtonDoubleClick()
Definition MyGUI_WidgetInput.cpp:80
MyGUI::WidgetInput::onMouseButtonDoubleClick
virtual void onMouseButtonDoubleClick()
Definition MyGUI_WidgetInput.cpp:224
MyGUI::WidgetInput::onKeyLostFocus
virtual void onKeyLostFocus(Widget *_new)
Definition MyGUI_WidgetInput.cpp:228
MyGUI::WidgetInput::eventKeyLostFocus
EventHandle_WidgetWidget eventKeyLostFocus
Definition MyGUI_WidgetInput.h:181
MyGUI::WidgetInput::onMouseMove
virtual void onMouseMove(int _left, int _top)
Definition MyGUI_WidgetInput.cpp:204
MyGUI::WidgetInput::getInheritsPick
bool getInheritsPick() const
Definition MyGUI_WidgetInput.cpp:167
MyGUI::WidgetInput::eventMouseMove
EventHandle_WidgetIntInt eventMouseMove
Definition MyGUI_WidgetInput.h:137
MyGUI::WidgetInput::setNeedMouseFocus
void setNeedMouseFocus(bool _value)
Definition MyGUI_WidgetInput.cpp:152
MyGUI::WidgetInput::onMouseDrag
virtual void onMouseDrag(int _left, int _top, MouseButton _id)
Definition MyGUI_WidgetInput.cpp:200
MyGUI::WidgetInput::onMouseSetFocus
virtual void onMouseSetFocus(Widget *_old)
Definition MyGUI_WidgetInput.cpp:196
MyGUI::WidgetInput::setMaskPick
void setMaskPick(const std::string &_filename)
Definition MyGUI_WidgetInput.cpp:14
MyGUI::WidgetInput::eventMouseButtonReleased
EventHandle_WidgetIntIntButton eventMouseButtonReleased
Definition MyGUI_WidgetInput.h:162
MyGUI::WidgetInput::getPointer
const std::string & getPointer() const
Definition MyGUI_WidgetInput.cpp:137
MyGUI::WidgetInput::setNeedKeyFocus
void setNeedKeyFocus(bool _value)
Definition MyGUI_WidgetInput.cpp:142
MyGUI::WidgetInput::_riseKeyButtonReleased
void _riseKeyButtonReleased(KeyCode _key)
Definition MyGUI_WidgetInput.cpp:104
MyGUI::WidgetInput::_riseKeySetFocus
void _riseKeySetFocus(Widget *_old)
Definition MyGUI_WidgetInput.cpp:92
MyGUI::WidgetInput::getNeedToolTip
bool getNeedToolTip() const
Definition MyGUI_WidgetInput.cpp:127
MyGUI::WidgetInput::~WidgetInput
virtual ~WidgetInput()=default
MyGUI::WidgetInput::_riseKeyButtonPressed
void _riseKeyButtonPressed(KeyCode _key, Char _char)
Definition MyGUI_WidgetInput.cpp:98
MyGUI::WidgetInput::onMouseWheel
virtual void onMouseWheel(int _rel)
Definition MyGUI_WidgetInput.cpp:208
MyGUI::WidgetInput::getNeedMouseFocus
bool getNeedMouseFocus() const
Definition MyGUI_WidgetInput.cpp:157
MyGUI::WidgetInput::_riseMouseWheel
void _riseMouseWheel(int _rel)
Definition MyGUI_WidgetInput.cpp:56
MyGUI::WidgetInput::_riseMouseDrag
void _riseMouseDrag(int _left, int _top, MouseButton _id)
Definition MyGUI_WidgetInput.cpp:44
MyGUI::WidgetInput::eventMouseButtonPressed
EventHandle_WidgetIntIntButton eventMouseButtonPressed
Definition MyGUI_WidgetInput.h:153
MyGUI::WidgetInput::eventMouseSetFocus
EventHandle_WidgetWidget eventMouseSetFocus
Definition MyGUI_WidgetInput.h:121
MyGUI::WidgetInput::eventToolTip
EventHandle_WidgetToolTip eventToolTip
Definition MyGUI_WidgetInput.h:226
MyGUI::WidgetInput::_riseMouseButtonReleased
void _riseMouseButtonReleased(int _left, int _top, MouseButton _id)
Definition MyGUI_WidgetInput.cpp:68
MyGUI::WidgetInput::isMaskPickInside
bool isMaskPickInside(const IntPoint &_point, const IntCoord &_coord) const
Definition MyGUI_WidgetInput.cpp:27
MyGUI::WidgetInput::eventKeyButtonPressed
EventHandle_WidgetKeyCodeChar eventKeyButtonPressed
Definition MyGUI_WidgetInput.h:196
MyGUI::WidgetInput::onMouseButtonPressed
virtual void onMouseButtonPressed(int _left, int _top, MouseButton _id)
Definition MyGUI_WidgetInput.cpp:212
MyGUI::WidgetInput::setInheritsPick
void setInheritsPick(bool _value)
Definition MyGUI_WidgetInput.cpp:162
MyGUI::WidgetInput::_riseMouseSetFocus
void _riseMouseSetFocus(Widget *_old)
Definition MyGUI_WidgetInput.cpp:38
MyGUI::WidgetInput::onMouseLostFocus
virtual void onMouseLostFocus(Widget *_new)
Definition MyGUI_WidgetInput.cpp:192
MyGUI::WidgetInput::_riseMouseButtonPressed
void _riseMouseButtonPressed(int _left, int _top, MouseButton _id)
Definition MyGUI_WidgetInput.cpp:62
MyGUI::WidgetInput::setPointer
void setPointer(std::string_view _value)
Definition MyGUI_WidgetInput.cpp:132
MyGUI::WidgetInput::_riseMouseLostFocus
void _riseMouseLostFocus(Widget *_new)
Definition MyGUI_WidgetInput.cpp:32
MyGUI::WidgetInput::setNeedToolTip
void setNeedToolTip(bool _value)
Definition MyGUI_WidgetInput.cpp:122
MyGUI::WidgetInput::eventMouseLostFocus
EventHandle_WidgetWidget eventMouseLostFocus
Definition MyGUI_WidgetInput.h:114
MyGUI::WidgetInput::onMouseButtonReleased
virtual void onMouseButtonReleased(int _left, int _top, MouseButton _id)
Definition MyGUI_WidgetInput.cpp:216
MyGUI::WidgetInput::eventKeySetFocus
EventHandle_WidgetWidget eventKeySetFocus
Definition MyGUI_WidgetInput.h:188
MyGUI::WidgetInput::_riseKeyChangeRootFocus
void _riseKeyChangeRootFocus(bool _focus)
Definition MyGUI_WidgetInput.cpp:116
MyGUI::WidgetInput::onKeySetFocus
virtual void onKeySetFocus(Widget *_old)
Definition MyGUI_WidgetInput.cpp:232
MyGUI::WidgetInput::onMouseChangeRootFocus
virtual void onMouseChangeRootFocus(bool _focus)
Definition MyGUI_WidgetInput.cpp:244
MyGUI::WidgetInput::eventRootKeyChangeFocus
EventHandle_WidgetBool eventRootKeyChangeFocus
Definition MyGUI_WidgetInput.h:219
MyGUI::WidgetInput::getNeedKeyFocus
bool getNeedKeyFocus() const
Definition MyGUI_WidgetInput.cpp:147
MyGUI::WidgetInput::_riseKeyLostFocus
void _riseKeyLostFocus(Widget *_new)
Definition MyGUI_WidgetInput.cpp:86
MyGUI::WidgetInput::_setRootKeyFocus
void _setRootKeyFocus(bool _value)
Definition MyGUI_WidgetInput.cpp:187
MyGUI::WidgetInput::eventRootMouseChangeFocus
EventHandle_WidgetBool eventRootMouseChangeFocus
Definition MyGUI_WidgetInput.h:211
MyGUI::WidgetInput::onKeyButtonPressed
virtual void onKeyButtonPressed(KeyCode _key, Char _char)
Definition MyGUI_WidgetInput.cpp:236
MyGUI::WidgetInput::onMouseButtonClick
virtual void onMouseButtonClick()
Definition MyGUI_WidgetInput.cpp:220
MyGUI::WidgetInput::onKeyChangeRootFocus
virtual void onKeyChangeRootFocus(bool _focus)
Definition MyGUI_WidgetInput.cpp:248
MyGUI::WidgetInput::eventMouseDrag
EventPairAddParameter< EventHandle_WidgetIntInt, EventHandle_WidgetIntIntButton > eventMouseDrag
Definition MyGUI_WidgetInput.h:129
MyGUI::WidgetInput::_setRootMouseFocus
void _setRootMouseFocus(bool _value)
Definition MyGUI_WidgetInput.cpp:182
MyGUI::WidgetInput::onKeyButtonReleased
virtual void onKeyButtonReleased(KeyCode _key)
Definition MyGUI_WidgetInput.cpp:240
MyGUI::WidgetInput::_riseMouseButtonClick
void _riseMouseButtonClick()
Definition MyGUI_WidgetInput.cpp:74
MyGUI::WidgetInput::_riseMouseChangeRootFocus
void _riseMouseChangeRootFocus(bool _focus)
Definition MyGUI_WidgetInput.cpp:110
MyGUI::WidgetInput::eventMouseWheel
EventHandle_WidgetInt eventMouseWheel
Definition MyGUI_WidgetInput.h:144
MyGUI::WidgetInput::getRootMouseFocus
bool getRootMouseFocus() const
Definition MyGUI_WidgetInput.cpp:172
MyGUI::WidgetInput::eventKeyButtonReleased
EventHandle_WidgetKeyCode eventKeyButtonReleased
Definition MyGUI_WidgetInput.h:203
MyGUI::delegates::MultiDelegate
Definition MyGUI_Delegate.h:190
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::EventHandle_WidgetToolTip
delegates::MultiDelegate< Widget *, const ToolTipInfo & > EventHandle_WidgetToolTip
Definition MyGUI_WidgetInput.h:57
MyGUI::EventHandle_WidgetIntIntButton
delegates::MultiDelegate< Widget *, int, int, MouseButton > EventHandle_WidgetIntIntButton
Definition MyGUI_WidgetInput.h:54
MyGUI::IntPoint
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
MyGUI::EventHandle_WidgetKeyCodeChar
delegates::MultiDelegate< Widget *, KeyCode, Char > EventHandle_WidgetKeyCodeChar
Definition MyGUI_WidgetInput.h:56
MyGUI::EventHandle_WidgetSizeT
delegates::MultiDelegate< Widget *, size_t > EventHandle_WidgetSizeT
Definition MyGUI_WidgetInput.h:52
MyGUI::EventHandle_WidgetBool
delegates::MultiDelegate< Widget *, bool > EventHandle_WidgetBool
Definition MyGUI_WidgetInput.h:50
MyGUI::EventHandle_WidgetWidget
delegates::MultiDelegate< Widget *, Widget * > EventHandle_WidgetWidget
Definition MyGUI_WidgetInput.h:49
MyGUI::EventHandle_WidgetVoid
delegates::MultiDelegate< Widget * > EventHandle_WidgetVoid
Definition MyGUI_WidgetInput.h:48
MyGUI::Char
unsigned int Char
Definition MyGUI_Types.h:50
MyGUI::IntCoord
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
MyGUI::EventHandle_WidgetIntInt
delegates::MultiDelegate< Widget *, int, int > EventHandle_WidgetIntInt
Definition MyGUI_WidgetInput.h:53
MyGUI::EventHandle_WidgetKeyCode
delegates::MultiDelegate< Widget *, KeyCode > EventHandle_WidgetKeyCode
Definition MyGUI_WidgetInput.h:55
MyGUI::EventHandle_WidgetInt
delegates::MultiDelegate< Widget *, int > EventHandle_WidgetInt
Definition MyGUI_WidgetInput.h:51
MyGUI::KeyCode
Definition MyGUI_KeyCode.h:16
MyGUI::MouseButton
Definition MyGUI_MouseButton.h:16