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