MyGUI 3.2.2

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

- File List
- Globals

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