| 386 | } |
| 387 | |
| 388 | void GuiTextEditCtrl::onMouseDown( const GuiEvent &event ) |
| 389 | { |
| 390 | if(!isActive()) |
| 391 | return; |
| 392 | mDragHit = false; |
| 393 | |
| 394 | // If we have a double click, select all text. Otherwise |
| 395 | // act as before by clearing any selection. |
| 396 | bool doubleClick = (event.mouseClickCount > 1 && Platform::getRealMilliseconds() - mMouseUpTime > mDoubleClickTimeMS); |
| 397 | if(doubleClick) |
| 398 | { |
| 399 | selectAllText(); |
| 400 | |
| 401 | } else |
| 402 | { |
| 403 | //undo any block function |
| 404 | mBlockStart = 0; |
| 405 | mBlockEnd = 0; |
| 406 | } |
| 407 | |
| 408 | //find out where the cursor should be |
| 409 | S32 pos = calculateCursorPos( event.mousePoint ); |
| 410 | |
| 411 | // if the position is to the left |
| 412 | if ( pos == -1 ) |
| 413 | mCursorPos = 0; |
| 414 | else if ( pos == -2 ) //else if the position is to the right |
| 415 | mCursorPos = mTextBuffer.length(); |
| 416 | else //else set the mCursorPos |
| 417 | mCursorPos = pos; |
| 418 | |
| 419 | //save the mouseDragPos |
| 420 | mMouseDragStart = mCursorPos; |
| 421 | |
| 422 | // lock the mouse |
| 423 | mouseLock(); |
| 424 | |
| 425 | //set the drag var |
| 426 | mDragHit = true; |
| 427 | |
| 428 | //let the parent get the event |
| 429 | setFirstResponder(); |
| 430 | } |
| 431 | |
| 432 | void GuiTextEditCtrl::onMouseDragged( const GuiEvent &event ) |
| 433 | { |