MCPcopy Create free account
hub / github.com/MyGUI/mygui / injectMousePress

Method injectMousePress

MyGUIEngine/src/MyGUI_InputManager.cpp:212–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210 }
211
212 bool InputManager::injectMousePress(int _absx, int _absy, MouseButton _id)
213 {
214 injectMouseMove(_absx, _absy, mOldAbsZ);
215
216 if (MouseButton::None != _id && MouseButton::MAX != _id)
217 {
218 // start capture
219 mMouseCapture[_id.getValue()] = true;
220 }
221
222 // если мы щелкнули не на гуй
223 if (!isFocusMouse())
224 {
225 resetKeyFocusWidget();
226
227 return false;
228 }
229
230 // если активный элемент заблокирован
231 //FIXME
232 if (!mWidgetMouseFocus->getInheritedEnabled())
233 return true;
234
235 if (MouseButton::None != _id && MouseButton::MAX != _id)
236 {
237 // remember last pressed position
238 if (mLayerMouseFocus != nullptr)
239 {
240 IntPoint point = mLayerMouseFocus->getPosition(_absx, _absy);
241 mLastPressed[_id.getValue()] = point;
242 }
243 }
244
245 // ищем вверх тот виджет который может принимать фокус
246 Widget* item = mWidgetMouseFocus;
247 while ((item != nullptr) && (!item->getNeedKeyFocus()))
248 item = item->getParent();
249
250 // устанавливаем перед вызовом т.к. возможно внутри ктонить поменяет фокус под себя
251 setKeyFocusWidget(item);
252
253 if (isFocusMouse())
254 {
255 IntPoint point(_absx, _absy);
256 if (mLayerMouseFocus != nullptr)
257 point = mLayerMouseFocus->getPosition(_absx, _absy);
258 mWidgetMouseFocus->_riseMouseButtonPressed(point.left, point.top, _id);
259
260 // после пресса может сброситься
261 if (mWidgetMouseFocus)
262 {
263 // поднимаем виджет, надо подумать что делать если поменялся фокус клавы
264 LayerManager::getInstance().upLayerItem(mWidgetMouseFocus);
265
266 // поднимаем пикинг Overlapped окон
267 Widget* pick = mWidgetMouseFocus;
268 do
269 {

Callers

nothing calls this directly

Calls 9

getInheritedEnabledMethod · 0.80
getNeedKeyFocusMethod · 0.80
getWidgetStyleMethod · 0.80
_forcePickMethod · 0.80
getValueMethod · 0.45
getPositionMethod · 0.45
getParentMethod · 0.45
upLayerItemMethod · 0.45

Tested by

no test coverage detected