Permalink
Browse files

ctrl+a support in Labels

  • Loading branch information...
jacob1 committed Dec 18, 2015
1 parent 7620933 commit 76aeef24a4614e71c1e9d46ded67f1bff4de9726
Showing with 13 additions and 8 deletions.
  1. +12 −0 src/gui/interface/Label.cpp
  2. +1 −0 src/gui/interface/Label.h
  3. +0 −7 src/gui/interface/Textbox.cpp
  4. +0 −1 src/gui/interface/Textbox.h
@@ -233,6 +233,11 @@ void Label::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool al
{
copySelection();
}
if(ctrl && key == 'a')
{
selectAll();
return;
}
}
void Label::OnMouseMoved(int localx, int localy, int dx, int dy)
@@ -280,6 +285,13 @@ void Label::ClearSelection()
updateSelection();
}
void Label::selectAll()
{
selectionIndex0 = 0;
selectionIndex1 = text.length();
updateSelection();
}
void Label::updateSelection()
{
std::string currentText;
@@ -54,6 +54,7 @@ namespace ui
virtual bool HasSelection();
virtual void ClearSelection();
virtual void selectAll();
virtual void AutoHeight();
void SetTextColour(Colour textColour) { this->textColour = textColour; }
@@ -182,13 +182,6 @@ void Textbox::cutSelection()
actionCallback->TextChangedCallback(this);
}
void Textbox::selectAll()
{
selectionIndex0 = 0;
selectionIndex1 = text.length();
updateSelection();
}
void Textbox::pasteIntoSelection()
{
std::string newText = format::CleanString(ClipboardPull(), true, true, inputType != Multiline, inputType == Number || inputType == Numeric);
@@ -69,7 +69,6 @@ class Textbox : public Label
std::string backingText;
std::string placeHolder;
virtual void selectAll();
virtual void cutSelection();
virtual void pasteIntoSelection();
};

0 comments on commit 76aeef2

Please sign in to comment.