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

Method onCopy

Engine/source/gui/controls/guiTextEditCtrl.cpp:479–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477}
478
479void GuiTextEditCtrl::onCopy(bool andCut)
480{
481 // Don't copy/cut password field!
482 if(mPasswordText)
483 return;
484
485 if (mBlockEnd > 0)
486 {
487 //save the current state
488 saveUndoState();
489
490 //copy the text to the clipboard
491 UTF8* clipBuff = mTextBuffer.createSubstring8(mBlockStart, mBlockEnd - mBlockStart);
492 Platform::setClipboard(clipBuff);
493 delete[] clipBuff;
494
495 //if we pressed the cut shortcut, we need to cut the selected text from the control...
496 if (andCut)
497 {
498 mTextBuffer.cut(mBlockStart, mBlockEnd - mBlockStart);
499 mCursorPos = mBlockStart;
500 }
501
502 mBlockStart = 0;
503 mBlockEnd = 0;
504 }
505
506}
507
508void GuiTextEditCtrl::onPaste()
509{

Callers

nothing calls this directly

Calls 2

createSubstring8Method · 0.80
cutMethod · 0.80

Tested by

no test coverage detected