16 template <> ToolTipManager* Singleton<ToolTipManager>::msInstance =
nullptr;
17 template <>
const char* Singleton<ToolTipManager>::mClassTypeName =
"ToolTipManager";
22 mToolTipVisible(false),
36 mOldFocusWidget =
nullptr;
37 mToolTipVisible =
false;
58 mIsInitialise =
false;
61 void ToolTipManager::notifyEventFrameStart(
float _time)
64 if (mOldFocusWidget != widget)
68 mToolTipVisible =
false;
69 hideToolTip(mOldFocusWidget);
71 mOldFocusWidget = widget;
74 if (mOldFocusWidget !=
nullptr)
78 mOldIndex = getToolTipIndex(mOldFocusWidget);
79 mNeedToolTip = isNeedToolTip(mOldFocusWidget);
82 else if (mNeedToolTip)
89 mToolTipVisible =
false;
90 hideToolTip(mOldFocusWidget);
96 if (!mToolTipVisible && point != mOldMousePoint)
100 mToolTipVisible =
false;
101 hideToolTip(mOldFocusWidget);
104 mOldMousePoint = point;
105 mOldIndex = getToolTipIndex(mOldFocusWidget);
109 size_t index = getToolTipIndex(mOldFocusWidget);
110 if (mOldIndex != index)
114 mToolTipVisible =
false;
115 hideToolTip(mOldFocusWidget);
122 if (!mToolTipVisible)
124 mCurrentTime += _time;
125 if (mCurrentTime >= mDelayVisible)
127 mToolTipVisible =
true;
128 showToolTip(mOldFocusWidget, mOldIndex, point);
131 else if (point != mOldMousePoint)
133 moveToolTip(mOldFocusWidget, mOldIndex, point);
143 if (mOldFocusWidget == _widget)
147 mToolTipVisible =
false;
148 hideToolTip(mOldFocusWidget);
150 mOldFocusWidget =
nullptr;
151 mNeedToolTip =
false;
155 void ToolTipManager::hideToolTip(
Widget* _widget)
158 if (container !=
nullptr)
164 void ToolTipManager::showToolTip(Widget* _widget,
size_t _index,
const IntPoint& _point)
167 if (container !=
nullptr)
173 void ToolTipManager::moveToolTip(Widget* _widget,
size_t _index,
const IntPoint& _point)
175 Widget* container = _widget->_getContainer();
176 if (container !=
nullptr)
177 container->eventToolTip(container, ToolTipInfo(
ToolTipInfo::Move, _index, _point));
182 bool ToolTipManager::isNeedToolTip(Widget* _widget)
184 Widget* container = _widget->_getContainer();
185 if (container !=
nullptr)
186 return container->getNeedToolTip();
187 return _widget->getNeedToolTip();
190 size_t ToolTipManager::getToolTipIndex(Widget* _widget)
const
192 Widget* container = _widget->_getContainer();
193 if (container !=
nullptr)
194 return container->_getItemIndex(_widget);
200 mDelayVisible = _value;
205 return mDelayVisible;