26 mWidgetMouseFocus(nullptr),
27 mWidgetKeyFocus(nullptr),
28 mLayerMouseFocus(nullptr),
30 mIsShiftPressed(false),
31 mIsControlPressed(false),
34 mFirstPressKey(false),
38 mSingletonHolder(this)
48 mWidgetMouseFocus =
nullptr;
49 mWidgetKeyFocus =
nullptr;
50 mLayerMouseFocus =
nullptr;
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;
105 if (mLayerMouseFocus !=
nullptr)
110 if (mMouseCapture[i])
119 Widget* old_mouse_focus = mWidgetMouseFocus;
125 if (mWidgetMouseFocus == item)
130 if (mLayerMouseFocus !=
nullptr)
146 if (!mVectorModalRootWidget.empty())
148 if (root != mVectorModalRootWidget.back())
156 mLayerMouseFocus = root->
getLayer();
162 Widget* save_widget =
nullptr;
165 Widget* root_focus = item;
166 while (root_focus !=
nullptr)
170 save_widget = root_focus;
180 root_focus = mWidgetMouseFocus;
181 while (root_focus !=
nullptr)
183 if (root_focus == save_widget)
201 if (mLayerMouseFocus !=
nullptr)
202 point = mLayerMouseFocus->
getPosition(_absx, _absy);
208 mWidgetMouseFocus = item;
210 if (old_mouse_focus != mWidgetMouseFocus)
227 mMouseCapture[_id.
getValue()] =
true;
246 if (mLayerMouseFocus !=
nullptr)
249 mLastPressed[_id.
getValue()] = point;
254 Widget* item = mWidgetMouseFocus;
264 if (mLayerMouseFocus !=
nullptr)
265 point = mLayerMouseFocus->
getPosition(_absx, _absy);
269 if (mWidgetMouseFocus)
275 Widget* pick = mWidgetMouseFocus;
300 mMouseCapture[_id.
getValue()] =
false;
311 if (mLayerMouseFocus !=
nullptr)
312 point = mLayerMouseFocus->
getPosition(_absx, _absy);
316 if (
nullptr != mWidgetMouseFocus)
324 if (
nullptr != mWidgetMouseFocus)
331 if ( item == mWidgetMouseFocus)
335 mTimerDoubleClick = 0;
352 firstEncoding(_key,
true);
355 storeKey(_key, _text);
371 firstEncoding(_key,
false);
384 void InputManager::firstEncoding(
KeyCode _key,
bool bIsKeyPressed)
387 mIsShiftPressed = bIsKeyPressed;
389 mIsControlPressed = bIsKeyPressed;
394 if (_widget == mWidgetKeyFocus)
397 Widget* oldKeyFocus = mWidgetKeyFocus;
398 mWidgetKeyFocus =
nullptr;
400 Widget* sharedRootFocus =
nullptr;
403 Widget* rootFocus = _widget;
404 while (rootFocus !=
nullptr)
408 sharedRootFocus = rootFocus;
418 rootFocus = oldKeyFocus;
419 while (rootFocus !=
nullptr)
421 if (rootFocus == sharedRootFocus)
430 mWidgetKeyFocus = _widget;
447 Widget* mouseFocus = mWidgetMouseFocus;
448 mWidgetMouseFocus =
nullptr;
451 Widget* root_focus = mouseFocus;
452 while (root_focus !=
nullptr)
461 if (mMouseCapture[i])
463 mMouseCapture[i] =
false;
464 if (
nullptr != mouseFocus)
471 if (
nullptr != mouseFocus)
476 if (mouseFocus != mWidgetMouseFocus)
481 void InputManager::_unlinkWidget(
Widget* _widget)
483 if (
nullptr == _widget)
486 if (mWidgetMouseFocus == _widget)
489 if (_widget == mWidgetKeyFocus)
493 for (VectorWidgetPtr::iterator iter = mVectorModalRootWidget.begin(); iter != mVectorModalRootWidget.end(); ++iter)
495 if (*iter == _widget)
497 mVectorModalRootWidget.erase(iter);
505 if (
nullptr == _widget)
511 mVectorModalRootWidget.push_back(_widget);
522 for (VectorWidgetPtr::iterator iter = mVectorModalRootWidget.begin(); iter != mVectorModalRootWidget.end(); ++iter)
524 if (*iter == _widget)
526 mVectorModalRootWidget.erase(iter);
531 if (!mVectorModalRootWidget.empty())
538 void InputManager::storeKey(
KeyCode _key,
Char _text)
549 mFirstPressKey =
true;
555 void InputManager::resetKey()
561 void InputManager::frameEntered(
float _frame)
563 mTimerDoubleClick += _frame;
581 mFirstPressKey =
false;
602 if (mWidgetKeyFocus == _widget)
608 if (mLayerMouseFocus !=
nullptr)
610 return mMousePosition;
615 return mWidgetMouseFocus !=
nullptr;
620 return mWidgetKeyFocus !=
nullptr;
627 if (mMouseCapture[i])
640 return mWidgetMouseFocus;
645 return mWidgetKeyFocus;
652 return mLastPressed[_id.
getValue()];
659 return mMousePosition;
664 return !mVectorModalRootWidget.empty();
669 return mIsControlPressed;
674 return mIsShiftPressed;
681 mMouseCapture[i] =
false;
687 _unlinkWidget(_widget);
#define MYGUI_ASSERT(exp, dest)
#define MYGUI_LOG(level, text)
static const IntPoint & getZeroIntPoint()
static Gui & getInstance()
EventHandle_FrameEventDelegate eventFrameStart
virtual IntPoint getPosition(int _left, int _top) const =0
ILayer * getLayer() const
void upLayerItem(Widget *_item)
static LayerManager & getInstance()
Widget * getWidgetFromPoint(int _left, int _top) const
const float INPUT_TIME_DOUBLE_CLICK
delegates::DelegateFunction< Args... > * newDelegate(void(*_func)(Args... args))
MYGUI_SINGLETON_DEFINITION(ClipboardManager)
const float INPUT_INTERVAL_KEY
const float INPUT_DELAY_FIRST_KEY
void set(T const &_left, T const &_top)