MyGUI: MyGUI_WidgetInput.cpp Source File

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