| 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 | { |
nothing calls this directly
no test coverage detected