From 06112a12a0c9dbf596fb5e3ef0345d918a641596 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sun, 5 Aug 2012 20:20:55 +0100 Subject: [PATCH] Ctrl+A select all --- src/interface/Textbox.cpp | 12 ++++++++++++ src/interface/Textbox.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/interface/Textbox.cpp b/src/interface/Textbox.cpp index 8444b8594..a57d69afb 100644 --- a/src/interface/Textbox.cpp +++ b/src/interface/Textbox.cpp @@ -174,6 +174,13 @@ void Textbox::cutSelection() } } +void Textbox::selectAll() +{ + selectionIndex0 = 0; + selectionIndex1 = text.length(); + updateSelection(); +} + void Textbox::pasteIntoSelection() { char * clipboardText; @@ -275,6 +282,11 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool cutSelection(); return; } + if(ctrl && key == 'a') + { + selectAll(); + return; + } try { diff --git a/src/interface/Textbox.h b/src/interface/Textbox.h index d9695dd0c..2bc959dd6 100644 --- a/src/interface/Textbox.h +++ b/src/interface/Textbox.h @@ -67,6 +67,7 @@ protected: std::string backingText; std::string placeHolder; + virtual void selectAll(); virtual void cutSelection(); virtual void pasteIntoSelection(); };