43 mIsShiftPressed(false),
44 mIsControlPressed(false),
47 mFirstPressKey(false),
60 mWidgetMouseFocus = 0;
65 mMouseCapture[i] =
false;
67 mIsShiftPressed =
false;
68 mIsControlPressed =
false;
71 mFirstPressKey =
true;
91 mIsInitialise =
false;
97 mMousePosition.
set(_absx, _absy);
100 int relz = _absz - mOldAbsZ;
116 if (mLayerMouseFocus !=
nullptr)
121 if (mMouseCapture[i])
134 Widget* old_mouse_focus = mWidgetMouseFocus;
140 if (mWidgetMouseFocus == item)
145 if (mLayerMouseFocus !=
nullptr)
161 if (!mVectorModalRootWidget.empty())
163 if (root != mVectorModalRootWidget.back())
171 mLayerMouseFocus = root->
getLayer();
177 Widget* save_widget =
nullptr;
180 Widget* root_focus = item;
181 while (root_focus !=
nullptr)
185 save_widget = root_focus;
195 root_focus = mWidgetMouseFocus;
196 while (root_focus !=
nullptr)
198 if (root_focus == save_widget)
213 if ((item !=
nullptr) && (item->
getEnabled()))
220 mWidgetMouseFocus = item;
222 if (old_mouse_focus != mWidgetMouseFocus)
230 Widget* old_key_focus = mWidgetKeyFocus;
237 if (old_key_focus != mWidgetKeyFocus)
251 mMouseCapture[_id.
toValue()] =
true;
253 if (mLayerMouseFocus !=
nullptr)
256 mLastPressed[_id.
toValue()] = point;
261 Widget* item = mWidgetMouseFocus;
273 if (mWidgetMouseFocus)
279 Widget* pick = mWidgetMouseFocus;
294 if (old_key_focus != mWidgetKeyFocus)
310 if (mMouseCapture[_id.
toValue()])
313 mMouseCapture[_id.
toValue()] =
false;
320 if (
nullptr != mWidgetMouseFocus)
328 if (
nullptr != mWidgetMouseFocus)
335 if ( item == mWidgetMouseFocus)
356 firstEncoding(_key,
true);
359 storeKey(_key, _text);
375 firstEncoding(_key,
false);
388 void InputManager::firstEncoding(
KeyCode _key,
bool bIsKeyPressed)
391 mIsShiftPressed = bIsKeyPressed;
393 mIsControlPressed = bIsKeyPressed;
398 if (_widget == mWidgetKeyFocus)
403 Widget* save_widget =
nullptr;
406 Widget* root_focus = _widget;
407 while (root_focus !=
nullptr)
411 save_widget = root_focus;
421 root_focus = mWidgetKeyFocus;
422 while (root_focus !=
nullptr)
424 if (root_focus == save_widget)
445 mWidgetKeyFocus = _widget;
450 Widget* mouseFocus = mWidgetMouseFocus;
451 mWidgetMouseFocus =
nullptr;
454 Widget* root_focus = mouseFocus;
455 while (root_focus !=
nullptr)
464 if (mMouseCapture[i])
466 mMouseCapture[i] =
false;
471 if (
nullptr != mouseFocus)
478 void InputManager::_unlinkWidget(
Widget* _widget)
480 if (
nullptr == _widget)
483 if (mWidgetMouseFocus == _widget)
486 if (_widget == mWidgetKeyFocus)
488 mWidgetKeyFocus =
nullptr;
492 for (VectorWidgetPtr::iterator iter = mVectorModalRootWidget.begin(); iter != mVectorModalRootWidget.end(); ++iter)
494 if ((*iter == _widget))
496 mVectorModalRootWidget.erase(iter);
504 if (
nullptr == _widget)
510 mVectorModalRootWidget.push_back(_widget);
521 for (VectorWidgetPtr::iterator iter = mVectorModalRootWidget.begin(); iter != mVectorModalRootWidget.end(); ++iter)
523 if ((*iter == _widget))
525 mVectorModalRootWidget.erase(iter);
530 if (!mVectorModalRootWidget.empty())
537 void InputManager::storeKey(
KeyCode _key,
Char _text)
548 mFirstPressKey =
true;
554 void InputManager::resetKey()
560 void InputManager::frameEntered(
float _frame)
578 mFirstPressKey =
false;
599 if (mWidgetKeyFocus == _widget)
605 if (mLayerMouseFocus !=
nullptr)
607 return mMousePosition;
612 return mWidgetMouseFocus !=
nullptr;
617 return mWidgetKeyFocus !=
nullptr;
624 if (mMouseCapture[i])
637 return mWidgetMouseFocus;
642 return mWidgetKeyFocus;
649 return mLastPressed[_id.
toValue()];
656 return mMousePosition;
661 return !mVectorModalRootWidget.empty();
666 return mIsControlPressed;
671 return mIsShiftPressed;
678 mMouseCapture[i] =
false;
684 _unlinkWidget(_widget);
const float INPUT_INTERVAL_KEY
EventHandle_FrameEventDelegate eventFrameStart
delegates::IDelegate0 * newDelegate(void(*_func)())
static WidgetManager & getInstance()
virtual IntPoint getPosition(int _left, int _top) const =0
static const IntPoint & getZeroIntPoint()
static const char * getClassTypeName()
unsigned long getMilliseconds()
#define MYGUI_LOG(level, text)
const float INPUT_DELAY_FIRST_KEY
#define MYGUI_ASSERT(exp, dest)
Widget * getWidgetFromPoint(int _left, int _top)
const unsigned long INPUT_TIME_DOUBLE_CLICK
ILayer * getLayer() const
static const char * mClassTypeName
void set(T const &_left, T const &_top)
void upLayerItem(Widget *_item)