MyGUI 3.2.0

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

- File List
- Globals

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