MyGUI: MyGUI_WidgetInput.cpp Source File

MyGUI 3.4.3

MyGUI_WidgetInput.cpp
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#include "MyGUI_Precompiled.h"
8#include "MyGUI_WidgetInput.h"
9#include "MyGUI_Widget.h"
10
11namespace MyGUI
12{
13
14 void WidgetInput::setMaskPick(const std::string& _filename)
15 {
16 if (_filename.empty())
17 mOwnMaskPickInfo = MaskPickInfo();
18 else if (!mOwnMaskPickInfo.load(_filename))
19 MYGUI_LOG(Error, "mask not load '" << _filename << "'");
20 }
21
22 void WidgetInput::setMaskPick(const MaskPickInfo& _info)
23 {
24 mOwnMaskPickInfo = _info;
25 }
26
27 bool WidgetInput::isMaskPickInside(const IntPoint& _point, const IntCoord& _coord) const
28 {
29 return mOwnMaskPickInfo.empty() || mOwnMaskPickInfo.pick(_point, _coord);
30 }
31
32 void WidgetInput::_riseMouseLostFocus(Widget* _new)
33 {
34 onMouseLostFocus(_new);
35 eventMouseLostFocus(static_cast<Widget*>(this), _new);
36 }
37
38 void WidgetInput::_riseMouseSetFocus(Widget* _old)
39 {
40 onMouseSetFocus(_old);
41 eventMouseSetFocus(static_cast<Widget*>(this), _old);
42 }
43
44 void WidgetInput::_riseMouseDrag(int _left, int _top, MouseButton _id)
45 {
46 onMouseDrag(_left, _top, _id);
47 eventMouseDrag(static_cast<Widget*>(this), _left, _top, _id);
48 }
49
50 void WidgetInput::_riseMouseMove(int _left, int _top)
51 {
52 onMouseMove(_left, _top);
53 eventMouseMove(static_cast<Widget*>(this), _left, _top);
54 }
55
56 void WidgetInput::_riseMouseWheel(int _rel)
57 {
58 onMouseWheel(_rel);
59 eventMouseWheel(static_cast<Widget*>(this), _rel);
60 }
61
62 void WidgetInput::_riseMouseButtonPressed(int _left, int _top, MouseButton _id)
63 {
64 onMouseButtonPressed(_left, _top, _id);
65 eventMouseButtonPressed(static_cast<Widget*>(this), _left, _top, _id);
66 }
67
68 void WidgetInput::_riseMouseButtonReleased(int _left, int _top, MouseButton _id)
69 {
70 onMouseButtonReleased(_left, _top, _id);
71 eventMouseButtonReleased(static_cast<Widget*>(this), _left, _top, _id);
72 }
73
74 void WidgetInput::_riseMouseButtonClick()
75 {
76 onMouseButtonClick();
77 eventMouseButtonClick(static_cast<Widget*>(this));
78 }
79
80 void WidgetInput::_riseMouseButtonDoubleClick()
81 {
82 onMouseButtonDoubleClick();
83 eventMouseButtonDoubleClick(static_cast<Widget*>(this));
84 }
85
86 void WidgetInput::_riseKeyLostFocus(Widget* _new)
87 {
88 onKeyLostFocus(_new);
89 eventKeyLostFocus(static_cast<Widget*>(this), _new);
90 }
91
92 void WidgetInput::_riseKeySetFocus(Widget* _old)
93 {
94 onKeySetFocus(_old);
95 eventKeySetFocus(static_cast<Widget*>(this), _old);
96 }
97
98 void WidgetInput::_riseKeyButtonPressed(KeyCode _key, Char _char)
99 {
100 onKeyButtonPressed(_key, _char);
101 eventKeyButtonPressed(static_cast<Widget*>(this), _key, _char);
102 }
103
104 void WidgetInput::_riseKeyButtonReleased(KeyCode _key)
105 {
106 onKeyButtonReleased(_key);
107 eventKeyButtonReleased(static_cast<Widget*>(this), _key);
108 }
109
110 void WidgetInput::_riseMouseChangeRootFocus(bool _focus)
111 {
112 onMouseChangeRootFocus(_focus);
113 eventRootMouseChangeFocus(static_cast<Widget*>(this), _focus);
114 }
115
116 void WidgetInput::_riseKeyChangeRootFocus(bool _focus)
117 {
118 onKeyChangeRootFocus(_focus);
119 eventRootKeyChangeFocus(static_cast<Widget*>(this), _focus);
120 }
121
122 void WidgetInput::setNeedToolTip(bool _value)
123 {
124 mNeedToolTip = _value;
125 }
126
127 bool WidgetInput::getNeedToolTip() const
128 {
129 return mNeedToolTip;
130 }
131
132 void WidgetInput::setPointer(std::string_view _value)
133 {
134 mPointer = _value;
135 }
136
137 const std::string& WidgetInput::getPointer() const
138 {
139 return mPointer;
140 }
141
142 void WidgetInput::setNeedKeyFocus(bool _value)
143 {
144 mNeedKeyFocus = _value;
145 }
146
147 bool WidgetInput::getNeedKeyFocus() const
148 {
149 return mNeedKeyFocus;
150 }
151
152 void WidgetInput::setNeedMouseFocus(bool _value)
153 {
154 mNeedMouseFocus = _value;
155 }
156
157 bool WidgetInput::getNeedMouseFocus() const
158 {
159 return mNeedMouseFocus;
160 }
161
162 void WidgetInput::setInheritsPick(bool _value)
163 {
164 mInheritsPick = _value;
165 }
166
167 bool WidgetInput::getInheritsPick() const
168 {
169 return mInheritsPick;
170 }
171
172 bool WidgetInput::getRootMouseFocus() const
173 {
174 return mRootMouseFocus;
175 }
176
177 bool WidgetInput::getRootKeyFocus() const
178 {
179 return mRootKeyFocus;
180 }
181
182 void WidgetInput::_setRootMouseFocus(bool _value)
183 {
184 mRootMouseFocus = _value;
185 }
186
187 void WidgetInput::_setRootKeyFocus(bool _value)
188 {
189 mRootKeyFocus = _value;
190 }
191
192 void WidgetInput::onMouseLostFocus(Widget* _new)
193 {
194 }
195
196 void WidgetInput::onMouseSetFocus(Widget* _old)
197 {
198 }
199
200 void WidgetInput::onMouseDrag(int _left, int _top, MouseButton _id)
201 {
202 }
203
204 void WidgetInput::onMouseMove(int _left, int _top)
205 {
206 }
207
208 void WidgetInput::onMouseWheel(int _rel)
209 {
210 }
211
212 void WidgetInput::onMouseButtonPressed(int _left, int _top, MouseButton _id)
213 {
214 }
215
216 void WidgetInput::onMouseButtonReleased(int _left, int _top, MouseButton _id)
217 {
218 }
219
220 void WidgetInput::onMouseButtonClick()
221 {
222 }
223
224 void WidgetInput::onMouseButtonDoubleClick()
225 {
226 }
227
228 void WidgetInput::onKeyLostFocus(Widget* _new)
229 {
230 }
231
232 void WidgetInput::onKeySetFocus(Widget* _old)
233 {
234 }
235
236 void WidgetInput::onKeyButtonPressed(KeyCode _key, Char _char)
237 {
238 }
239
240 void WidgetInput::onKeyButtonReleased(KeyCode _key)
241 {
242 }
243
244 void WidgetInput::onMouseChangeRootFocus(bool _focus)
245 {
246 }
247
248 void WidgetInput::onKeyChangeRootFocus(bool _focus)
249 {
250 }
251
252} // namespace MyGUI
MYGUI_LOG
#define MYGUI_LOG(level, text)
Definition MyGUI_Diagnostic.h:17
MyGUI_Precompiled.h
MyGUI_Widget.h
MyGUI_WidgetInput.h
MyGUI::MaskPickInfo
Definition MyGUI_MaskPickInfo.h:17
MyGUI::MaskPickInfo::empty
bool empty() const
Definition MyGUI_MaskPickInfo.cpp:72
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:40
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::_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::_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
Definition MyGUI_ActionController.h:15
MyGUI::IntPoint
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
MyGUI::Char
unsigned int Char
Definition MyGUI_Types.h:50
MyGUI::IntCoord
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
MyGUI::KeyCode
Definition MyGUI_KeyCode.h:16
MyGUI::MouseButton
Definition MyGUI_MouseButton.h:16