31 mIsShiftPressed(false),
32 mIsControlPressed(false),
35 mFirstPressKey(false),
48 mWidgetMouseFocus = 0;
53 mMouseCapture[i] =
false;
55 mIsShiftPressed =
false;
56 mIsControlPressed =
false;
59 mFirstPressKey =
true;
79 mIsInitialise =
false;
85 mMousePosition.
set(_absx, _absy);
88 int relz = _absz - mOldAbsZ;
104 if (mLayerMouseFocus !=
nullptr)
109 if (mMouseCapture[i])
122 Widget* old_mouse_focus = mWidgetMouseFocus;
128 if (mWidgetMouseFocus == item)
133 if (mLayerMouseFocus !=
nullptr)
149 if (!mVectorModalRootWidget.empty())
151 if (root != mVectorModalRootWidget.back())
159 mLayerMouseFocus = root->
getLayer();
165 Widget* save_widget =
nullptr;
168 Widget* root_focus = item;
169 while (root_focus !=
nullptr)
173 save_widget = root_focus;
183 root_focus = mWidgetMouseFocus;
184 while (root_focus !=
nullptr)
186 if (root_focus == save_widget)
208 mWidgetMouseFocus = item;
210 if (old_mouse_focus != mWidgetMouseFocus)
240 mMouseCapture[_id.
getValue()] =
true;
242 if (mLayerMouseFocus !=
nullptr)
245 mLastPressed[_id.
getValue()] = point;
250 Widget* item = mWidgetMouseFocus;
262 if (mWidgetMouseFocus)
268 Widget* pick = mWidgetMouseFocus;
299 mMouseCapture[_id.
getValue()] =
false;
306 if (
nullptr != mWidgetMouseFocus)
314 if (
nullptr != mWidgetMouseFocus)
321 if ( item == mWidgetMouseFocus)
325 mTimerDoubleClick = 0;
342 firstEncoding(_key,
true);
345 storeKey(_key, _text);
361 firstEncoding(_key,
false);
374 void InputManager::firstEncoding(
KeyCode _key,
bool bIsKeyPressed)
377 mIsShiftPressed = bIsKeyPressed;
379 mIsControlPressed = bIsKeyPressed;
384 if (_widget == mWidgetKeyFocus)
389 Widget* save_widget =
nullptr;
392 Widget* root_focus = _widget;
393 while (root_focus !=
nullptr)
397 save_widget = root_focus;
407 root_focus = mWidgetKeyFocus;
408 while (root_focus !=
nullptr)
410 if (root_focus == save_widget)
431 mWidgetKeyFocus = _widget;
438 Widget* mouseFocus = mWidgetMouseFocus;
439 mWidgetMouseFocus =
nullptr;
442 Widget* root_focus = mouseFocus;
443 while (root_focus !=
nullptr)
452 if (mMouseCapture[i])
454 mMouseCapture[i] =
false;
459 if (
nullptr != mouseFocus)
464 if (mouseFocus != mWidgetMouseFocus)
469 void InputManager::_unlinkWidget(
Widget* _widget)
471 if (
nullptr == _widget)
474 if (mWidgetMouseFocus == _widget)
477 if (_widget == mWidgetKeyFocus)
479 mWidgetKeyFocus =
nullptr;
483 for (VectorWidgetPtr::iterator iter = mVectorModalRootWidget.begin(); iter != mVectorModalRootWidget.end(); ++iter)
485 if (*iter == _widget)
487 mVectorModalRootWidget.erase(iter);
495 if (
nullptr == _widget)
501 mVectorModalRootWidget.push_back(_widget);
512 for (VectorWidgetPtr::iterator iter = mVectorModalRootWidget.begin(); iter != mVectorModalRootWidget.end(); ++iter)
514 if (*iter == _widget)
516 mVectorModalRootWidget.erase(iter);
521 if (!mVectorModalRootWidget.empty())
528 void InputManager::storeKey(
KeyCode _key,
Char _text)
539 mFirstPressKey =
true;
545 void InputManager::resetKey()
551 void InputManager::frameEntered(
float _frame)
553 mTimerDoubleClick += _frame;
571 mFirstPressKey =
false;
592 if (mWidgetKeyFocus == _widget)
598 if (mLayerMouseFocus !=
nullptr)
600 return mMousePosition;
605 return mWidgetMouseFocus !=
nullptr;
610 return mWidgetKeyFocus !=
nullptr;
617 if (mMouseCapture[i])
630 return mWidgetMouseFocus;
635 return mWidgetKeyFocus;
642 return mLastPressed[_id.
getValue()];
649 return mMousePosition;
654 return !mVectorModalRootWidget.empty();
659 return mIsControlPressed;
664 return mIsShiftPressed;
671 mMouseCapture[i] =
false;
677 _unlinkWidget(_widget);
const float INPUT_INTERVAL_KEY
EventHandle_FrameEventDelegate eventFrameStart
ILayer * getLayer() const
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()
const float INPUT_TIME_DOUBLE_CLICK
#define MYGUI_LOG(level, text)
const float INPUT_DELAY_FIRST_KEY
#define MYGUI_ASSERT(exp, dest)
Widget * getWidgetFromPoint(int _left, int _top)
void set(T const &_left, T const &_top)
void upLayerItem(Widget *_item)