MyGUI  3.2.0
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 
30  mNeedToolTip(false),
31  mInheritsPick(false),
32  mNeedKeyFocus(false),
33  mNeedMouseFocus(true),
34  mRootMouseFocus(false),
35  mRootKeyFocus(false)
36  {
37  }
38 
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 
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 
62  {
63  onMouseLostFocus(_new);
64  eventMouseLostFocus(static_cast<Widget*>(this), _new);
65  }
66 
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 
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 
104  {
106  eventMouseButtonClick(static_cast<Widget*>(this));
107  }
108 
110  {
112  eventMouseButtonDoubleClick(static_cast<Widget*>(this));
113  }
114 
116  {
117  onKeyLostFocus(_new);
118  eventKeyLostFocus(static_cast<Widget*>(this), _new);
119  }
120 
122  {
123  onKeySetFocus(_old);
124  eventKeySetFocus(static_cast<Widget*>(this), _old);
125  }
126 
128  {
129  onKeyButtonPressed(_key, _char);
130  eventKeyButtonPressed(static_cast<Widget*>(this), _key, _char);
131  }
132 
134  {
135  onKeyButtonReleased(_key);
136  eventKeyButtonReleased(static_cast<Widget*>(this), _key);
137  }
138 
140  {
141  onMouseChangeRootFocus(_focus);
142  eventRootMouseChangeFocus(static_cast<Widget*>(this), _focus);
143  }
144 
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 
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 
172  {
173  mNeedKeyFocus = _value;
174  }
175 
177  {
178  return mNeedKeyFocus;
179  }
180 
182  {
183  mNeedMouseFocus = _value;
184  }
185 
187  {
188  return mNeedMouseFocus;
189  }
190 
192  {
193  mInheritsPick = _value;
194  }
195 
197  {
198  return mInheritsPick;
199  }
200 
202  {
203  return mRootMouseFocus;
204  }
205 
207  {
208  return mRootKeyFocus;
209  }
210 
212  {
213  mRootMouseFocus = _value;
214  }
215 
217  {
218  mRootKeyFocus = _value;
219  }
220 
222  {
223  }
224 
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 
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 
250  {
251  }
252 
254  {
255  }
256 
258  {
259  }
260 
262  {
263  }
264 
266  {
267  }
268 
270  {
271  }
272 
274  {
275  }
276 
278  {
279  }
280 
281 } // namespace MyGUI