mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-04-04 14:32:48 +02:00
ctrl+a support in Labels
This commit is contained in:
parent
762093371b
commit
76aeef24a4
src/gui/interface
@ -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 @@ protected:
|
||||
std::string backingText;
|
||||
std::string placeHolder;
|
||||
|
||||
virtual void selectAll();
|
||||
virtual void cutSelection();
|
||||
virtual void pasteIntoSelection();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user