MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / onCopy

Method onCopy

Engine/source/gui/controls/guiTextEditCtrl.cpp:466–493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464}
465
466void GuiTextEditCtrl::onCopy(bool andCut)
467{
468 // Don't copy/cut password field!
469 if(mPasswordText)
470 return;
471
472 if (mBlockEnd > 0)
473 {
474 //save the current state
475 saveUndoState();
476
477 //copy the text to the clipboard
478 UTF8* clipBuff = mTextBuffer.createSubstring8(mBlockStart, mBlockEnd - mBlockStart);
479 Platform::setClipboard(clipBuff);
480 delete[] clipBuff;
481
482 //if we pressed the cut shortcut, we need to cut the selected text from the control...
483 if (andCut)
484 {
485 mTextBuffer.cut(mBlockStart, mBlockEnd - mBlockStart);
486 mCursorPos = mBlockStart;
487 }
488
489 mBlockStart = 0;
490 mBlockEnd = 0;
491 }
492
493}
494
495void GuiTextEditCtrl::onPaste()
496{

Callers

nothing calls this directly

Calls 2

createSubstring8Method · 0.80
cutMethod · 0.80

Tested by

no test coverage detected