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)
224 Widget* old_key_focus = mWidgetKeyFocus;
231 if (old_key_focus != mWidgetKeyFocus)
245 mMouseCapture[_id.
getValue()] =
true;
247 if (mLayerMouseFocus !=
nullptr)
250 mLastPressed[_id.
getValue()] = point;
255 Widget* item = mWidgetMouseFocus;
267 if (mWidgetMouseFocus)
273 Widget* pick = mWidgetMouseFocus;
288 if (old_key_focus != mWidgetKeyFocus)
307 mMouseCapture[_id.
getValue()] =
false;
314 if (
nullptr != mWidgetMouseFocus)
322 if (
nullptr != mWidgetMouseFocus)
329 if ( item == mWidgetMouseFocus)
333 mTimerDoubleClick = 0;
350 firstEncoding(_key,
true);
353 storeKey(_key, _text);
369 firstEncoding(_key,
false);
382 void InputManager::firstEncoding(
KeyCode _key,
bool bIsKeyPressed)
385 mIsShiftPressed = bIsKeyPressed;
387 mIsControlPressed = bIsKeyPressed;
392 if (_widget == mWidgetKeyFocus)
397 Widget* save_widget =
nullptr;
400 Widget* root_focus = _widget;
401 while (root_focus !=
nullptr)
405 save_widget = root_focus;
415 root_focus = mWidgetKeyFocus;
416 while (root_focus !=
nullptr)
418 if (root_focus == save_widget)
439 mWidgetKeyFocus = _widget;
444 Widget* mouseFocus = mWidgetMouseFocus;
445 mWidgetMouseFocus =
nullptr;
448 Widget* root_focus = mouseFocus;
449 while (root_focus !=
nullptr)
458 if (mMouseCapture[i])
460 mMouseCapture[i] =
false;
465 if (
nullptr != mouseFocus)
472 void InputManager::_unlinkWidget(
Widget* _widget)
474 if (
nullptr == _widget)
477 if (mWidgetMouseFocus == _widget)
480 if (_widget == mWidgetKeyFocus)
482 mWidgetKeyFocus =
nullptr;
486 for (VectorWidgetPtr::iterator iter = mVectorModalRootWidget.begin(); iter != mVectorModalRootWidget.end(); ++iter)
488 if (*iter == _widget)
490 mVectorModalRootWidget.erase(iter);
498 if (
nullptr == _widget)
504 mVectorModalRootWidget.push_back(_widget);
515 for (VectorWidgetPtr::iterator iter = mVectorModalRootWidget.begin(); iter != mVectorModalRootWidget.end(); ++iter)
517 if (*iter == _widget)
519 mVectorModalRootWidget.erase(iter);
524 if (!mVectorModalRootWidget.empty())
531 void InputManager::storeKey(
KeyCode _key,
Char _text)
542 mFirstPressKey =
true;
548 void InputManager::resetKey()
554 void InputManager::frameEntered(
float _frame)
556 mTimerDoubleClick += _frame;
574 mFirstPressKey =
false;
595 if (mWidgetKeyFocus == _widget)
601 if (mLayerMouseFocus !=
nullptr)
603 return mMousePosition;
608 return mWidgetMouseFocus !=
nullptr;
613 return mWidgetKeyFocus !=
nullptr;
620 if (mMouseCapture[i])
633 return mWidgetMouseFocus;
638 return mWidgetKeyFocus;
645 return mLastPressed[_id.
getValue()];
652 return mMousePosition;
657 return !mVectorModalRootWidget.empty();
662 return mIsControlPressed;
667 return mIsShiftPressed;
674 mMouseCapture[i] =
false;
680 _unlinkWidget(_widget);