diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-25 17:11:36 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-25 17:11:36 (GMT) |
| commit | e88fca8aa1d4b0c585b50abf501ce733d1645f05 (patch) | |
| tree | 4bb6e1f6fad1a55fe65c46cc4146c911897cc9c5 /src/interface/Textbox.cpp | |
| parent | 5c293ba9bfca884e309a5fa7f67497eddd7e6643 (diff) | |
| download | powder-e88fca8aa1d4b0c585b50abf501ce733d1645f05.zip powder-e88fca8aa1d4b0c585b50abf501ce733d1645f05.tar.gz | |
Save ID copying for preview
Diffstat (limited to 'src/interface/Textbox.cpp')
| -rw-r--r-- | src/interface/Textbox.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/interface/Textbox.cpp b/src/interface/Textbox.cpp index 159c326..603fa23 100644 --- a/src/interface/Textbox.cpp +++ b/src/interface/Textbox.cpp @@ -19,7 +19,8 @@ Textbox::Textbox(Point position, Point size, std::string textboxText, std::strin limit(std::string::npos), inputType(All), keyDown(0), - characterDown(0) + characterDown(0), + ReadOnly(false) { placeHolder = textboxPlaceholder; @@ -268,12 +269,12 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool copySelection(); return; } - if(ctrl && key == 'v') + if(ctrl && key == 'v' && !ReadOnly) { pasteIntoSelection(); return; } - if(ctrl && key == 'x' && !masked) + if(ctrl && key == 'x' && !masked && !ReadOnly) { cutSelection(); return; @@ -307,6 +308,8 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool ClearSelection(); break; case KEY_DELETE: + if(ReadOnly) + break; if(HasSelection()) { if(getLowerSelectionBound() < 0 || getHigherSelectionBound() > backingText.length()) @@ -326,6 +329,8 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool ClearSelection(); break; case KEY_BACKSPACE: + if(ReadOnly) + break; if(HasSelection()) { if(getLowerSelectionBound() < 0 || getHigherSelectionBound() > backingText.length()) @@ -351,7 +356,7 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool ClearSelection(); break; } - if(CharacterValid(character)) + if(CharacterValid(character) && !ReadOnly) { if(HasSelection()) { |
