26 mWidgetMouseFocus(nullptr),
27 mWidgetKeyFocus(nullptr),
28 mLayerMouseFocus(nullptr),
30 mIsShiftPressed(false),
31 mIsControlPressed(false),
33 mIsMetaPressed(false),
36 mFirstPressKey(false),
40 mSingletonHolder(this)
50 mWidgetMouseFocus =
nullptr;
51 mWidgetKeyFocus =
nullptr;
52 mLayerMouseFocus =
nullptr;
55 mMouseCapture[i] =
false;
57 mIsShiftPressed =
false;
58 mIsControlPressed =
false;
59 mIsAltPressed =
false;
60 mIsMetaPressed =
false;
64 mFirstPressKey =
true;
84 mIsInitialise =
false;
90 mMousePosition.
set(_absx, _absy);
93 int relz = _absz - mOldAbsZ;
110 if (mLayerMouseFocus !=
nullptr)
115 if (mMouseCapture[i])
124 Widget* old_mouse_focus = mWidgetMouseFocus;
130 if (mWidgetMouseFocus == item)
135 if (mLayerMouseFocus !=
nullptr)
151 if (!mVectorModalRootWidget.empty())
153 if (root != mVectorModalRootWidget.back())
161 mLayerMouseFocus = root->
getLayer();
167 Widget* save_widget =
nullptr;
170 Widget* root_focus = item;
171 while (root_focus !=
nullptr)
175 save_widget = root_focus;
185 root_focus = mWidgetMouseFocus;
186 while (root_focus !=
nullptr)
188 if (root_focus == save_widget)
206 if (mLayerMouseFocus !=
nullptr)
207 point = mLayerMouseFocus->
getPosition(_absx, _absy);
213 mWidgetMouseFocus = item;
215 if (old_mouse_focus != mWidgetMouseFocus)
232 mMouseCapture[_id.
getValue()] =
true;
251 if (mLayerMouseFocus !=
nullptr)
254 mLastPressed[_id.
getValue()] = point;
259 Widget* item = mWidgetMouseFocus;
269 if (mLayerMouseFocus !=
nullptr)
270 point = mLayerMouseFocus->
getPosition(_absx, _absy);
274 if (mWidgetMouseFocus)
280 Widget* pick = mWidgetMouseFocus;
305 mMouseCapture[_id.
getValue()] =
false;
316 if (mLayerMouseFocus !=
nullptr)
317 point = mLayerMouseFocus->
getPosition(_absx, _absy);
321 if (
nullptr != mWidgetMouseFocus)
329 if (
nullptr != mWidgetMouseFocus)
336 if ( item == mWidgetMouseFocus)
340 mTimerDoubleClick = 0;
357 firstEncoding(_key,
true);
360 storeKey(_key, _text);
376 firstEncoding(_key,
false);
389 void InputManager::firstEncoding(
KeyCode _key,
bool bIsKeyPressed)
392 mIsShiftPressed = bIsKeyPressed;
394 mIsControlPressed = bIsKeyPressed;
396 mIsAltPressed = bIsKeyPressed;
398 mIsMetaPressed = bIsKeyPressed;
403 if (_widget == mWidgetKeyFocus)
406 Widget* oldKeyFocus = mWidgetKeyFocus;
407 mWidgetKeyFocus =
nullptr;
409 Widget* sharedRootFocus =
nullptr;
412 Widget* rootFocus = _widget;
413 while (rootFocus !=
nullptr)
417 sharedRootFocus = rootFocus;
427 rootFocus = oldKeyFocus;
428 while (rootFocus !=
nullptr)
430 if (rootFocus == sharedRootFocus)
439 mWidgetKeyFocus = _widget;
456 Widget* mouseFocus = mWidgetMouseFocus;
457 mWidgetMouseFocus =
nullptr;
460 Widget* root_focus = mouseFocus;
461 while (root_focus !=
nullptr)
470 if (mMouseCapture[i])
472 mMouseCapture[i] =
false;
473 if (
nullptr != mouseFocus)
480 if (
nullptr != mouseFocus)
485 if (mouseFocus != mWidgetMouseFocus)
490 void InputManager::_unlinkWidget(
Widget* _widget)
492 if (
nullptr == _widget)
495 if (mWidgetMouseFocus == _widget)
498 if (_widget == mWidgetKeyFocus)
502 for (VectorWidgetPtr::iterator iter = mVectorModalRootWidget.begin(); iter != mVectorModalRootWidget.end(); ++iter)
504 if (*iter == _widget)
506 mVectorModalRootWidget.erase(iter);
514 if (
nullptr == _widget)
520 mVectorModalRootWidget.push_back(_widget);
531 for (VectorWidgetPtr::iterator iter = mVectorModalRootWidget.begin(); iter != mVectorModalRootWidget.end(); ++iter)
533 if (*iter == _widget)
535 mVectorModalRootWidget.erase(iter);
540 if (!mVectorModalRootWidget.empty())
547 void InputManager::storeKey(
KeyCode _key,
Char _text)
558 mFirstPressKey =
true;
564 void InputManager::resetKey()
570 void InputManager::frameEntered(
float _frame)
572 mTimerDoubleClick += _frame;
590 mFirstPressKey =
false;
611 if (mWidgetKeyFocus == _widget)
617 if (mLayerMouseFocus !=
nullptr)
619 return mMousePosition;
624 return mWidgetMouseFocus !=
nullptr;
629 return mWidgetKeyFocus !=
nullptr;
636 if (mMouseCapture[i])
649 return mWidgetMouseFocus;
654 return mWidgetKeyFocus;
661 return mLastPressed[_id.
getValue()];
668 return mMousePosition;
673 return !mVectorModalRootWidget.empty();
678 return mIsControlPressed;
683 return mIsShiftPressed;
688 return mIsAltPressed;
693 return mIsMetaPressed;
700 mMouseCapture[i] =
false;
706 _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)