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

Method notifyMouseButtonDoubleClick

MyGUIEngine/src/MyGUI_EditBox.cpp:215–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213 }
214
215 void EditBox::notifyMouseButtonDoubleClick(Widget* _sender)
216 {
217 if (mClientText == nullptr)
218 return;
219
220 // в статике все недоступно
221 if (mModeStatic)
222 return;
223
224 const IntPoint& lastPressed = InputManager::getInstance().getLastPressedPosition(MouseButton::Left);
225
226 size_t cursorPosition = mClientText->getCursorPosition(lastPressed);
227 mStartSelect = cursorPosition;
228 mEndSelect = cursorPosition;
229
230 UString::utf32string text = this->getOnlyText().asUTF32();
231 UString::utf32string::reverse_iterator iterBack = text.rend() - cursorPosition;
232 UString::utf32string::iterator iterForw = text.begin() + cursorPosition;
233
234 while (iterBack != text.rend())
235 {
236 if (((*iterBack) < 256) && (ispunct(*iterBack) || isspace(*iterBack)))
237 break;
238 ++iterBack;
239 mStartSelect--;
240 }
241 while (iterForw != text.end())
242 {
243 if (((*iterForw) < 256) && (ispunct(*iterForw) || isspace(*iterForw)))
244 break;
245 ++iterForw;
246 mEndSelect++;
247 }
248
249 mClientText->setCursorPosition(mEndSelect);
250 mClientText->setTextSelection(mStartSelect, mEndSelect);
251 }
252
253 void EditBox::onMouseDrag(int _left, int _top, MouseButton _id)
254 {

Callers

nothing calls this directly

Calls 7

getOnlyTextMethod · 0.95
rendMethod · 0.80
setCursorPositionMethod · 0.80
getCursorPositionMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
setTextSelectionMethod · 0.45

Tested by

no test coverage detected