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