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

Method notifyMouseDrag

MyGUIEngine/src/MyGUI_EditBox.cpp:175–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173 }
174
175 void EditBox::notifyMouseDrag(Widget* _sender, int _left, int _top, MouseButton _id)
176 {
177 if (_id != MouseButton::Left)
178 return;
179
180 if (mClientText == nullptr)
181 return;
182
183 // в статике все недоступно
184 if (mModeStatic)
185 return;
186
187 // останавливаем курсор
188 mClientText->setVisibleCursor(true);
189
190 // сбрасываем все таймеры
191 mCursorTimer = 0;
192 mActionMouseTimer = 0;
193
194 size_t old = mCursorPosition;
195 IntPoint point(_left, _top);
196 mCursorPosition = mClientText->getCursorPosition(point);
197
198 if (old != mCursorPosition)
199 {
200 mClientText->setCursorPosition(mCursorPosition);
201
202 if (mStartSelect == ITEM_NONE)
203 mStartSelect = old;
204
205 mEndSelect = (size_t)mCursorPosition;
206 if (mStartSelect > mEndSelect)
207 mClientText->setTextSelection(mEndSelect, mStartSelect);
208 else
209 mClientText->setTextSelection(mStartSelect, mEndSelect);
210
211 updateViewWithCursor();
212 }
213 }
214
215 void EditBox::notifyMouseButtonDoubleClick(Widget* _sender)
216 {

Callers

nothing calls this directly

Calls 4

setVisibleCursorMethod · 0.80
setCursorPositionMethod · 0.80
getCursorPositionMethod · 0.45
setTextSelectionMethod · 0.45

Tested by

no test coverage detected