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

Method mouseDrag

MyGUIEngine/src/MyGUI_DDContainer.cpp:67–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65 }
66
67 void DDContainer::mouseDrag(MouseButton _id)
68 {
69 if (MouseButton::Left != _id)
70 return;
71
72 // нужно ли обновить данные
73 bool update = false;
74
75 // первый раз дропаем елемент
76 if (!mStartDrop && mDropSenderIndex != ITEM_NONE)
77 {
78 mStartDrop = true;
79 mNeedDrop = false;
80 update = true;
81 // запрос на нужность дропа по индексу
82 mDropInfo.set(this, mDropSenderIndex, nullptr, ITEM_NONE);
83 mReseiverContainer = nullptr;
84
85 eventStartDrag(this, mDropInfo, mNeedDrop);
86
87 if (mNeedDrop)
88 {
89 eventChangeDDState(this, DDItemState::Start);
90 }
91 else
92 {
93 // сбрасываем фокус мыши (не обязательно)
94 InputManager::getInstance().resetMouseCaptureWidget();
95 }
96 }
97
98 // дроп не нужен
99 if (!mNeedDrop)
100 {
101 return;
102 }
103
104 // делаем запрос, над кем наша мыша
105 const IntPoint& point = InputManager::getInstance().getMousePosition();
106 Widget* item = LayerManager::getInstance().getWidgetFromPoint(point.left, point.top);
107
108 updateDropItems();
109
110 // если равно, значит уже спрашивали
111 if (mOldDrop == item)
112 return;
113 mOldDrop = item;
114
115 // сбрасываем старую подсветку
116 if (mReseiverContainer)
117 mReseiverContainer->_setContainerItemInfo(mDropInfo.receiver_index, false, false);
118
119 mDropResult = false;
120 mReseiverContainer = nullptr;
121 Widget* receiver = nullptr;
122 // есть виджет под нами
123 if (item)
124 {

Callers

nothing calls this directly

Calls 11

eventStartDragFunction · 0.85
newDelegateFunction · 0.85
eventRequestDropFunction · 0.85
getWidgetFromPointMethod · 0.80
_getContainerMethod · 0.80
setMethod · 0.45
getMousePositionMethod · 0.45
_setContainerItemInfoMethod · 0.45
clearMethod · 0.45
_getItemIndexMethod · 0.45

Tested by

no test coverage detected