mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-13 20:04:01 +02:00
ctrl+a support in Labels
This commit is contained in:
@@ -233,6 +233,11 @@ void Label::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool al
|
|||||||
{
|
{
|
||||||
copySelection();
|
copySelection();
|
||||||
}
|
}
|
||||||
|
if(ctrl && key == 'a')
|
||||||
|
{
|
||||||
|
selectAll();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Label::OnMouseMoved(int localx, int localy, int dx, int dy)
|
void Label::OnMouseMoved(int localx, int localy, int dx, int dy)
|
||||||
@@ -280,6 +285,13 @@ void Label::ClearSelection()
|
|||||||
updateSelection();
|
updateSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Label::selectAll()
|
||||||
|
{
|
||||||
|
selectionIndex0 = 0;
|
||||||
|
selectionIndex1 = text.length();
|
||||||
|
updateSelection();
|
||||||
|
}
|
||||||
|
|
||||||
void Label::updateSelection()
|
void Label::updateSelection()
|
||||||
{
|
{
|
||||||
std::string currentText;
|
std::string currentText;
|
||||||
|
@@ -54,6 +54,7 @@ namespace ui
|
|||||||
|
|
||||||
virtual bool HasSelection();
|
virtual bool HasSelection();
|
||||||
virtual void ClearSelection();
|
virtual void ClearSelection();
|
||||||
|
virtual void selectAll();
|
||||||
virtual void AutoHeight();
|
virtual void AutoHeight();
|
||||||
|
|
||||||
void SetTextColour(Colour textColour) { this->textColour = textColour; }
|
void SetTextColour(Colour textColour) { this->textColour = textColour; }
|
||||||
|
@@ -182,13 +182,6 @@ void Textbox::cutSelection()
|
|||||||
actionCallback->TextChangedCallback(this);
|
actionCallback->TextChangedCallback(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Textbox::selectAll()
|
|
||||||
{
|
|
||||||
selectionIndex0 = 0;
|
|
||||||
selectionIndex1 = text.length();
|
|
||||||
updateSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Textbox::pasteIntoSelection()
|
void Textbox::pasteIntoSelection()
|
||||||
{
|
{
|
||||||
std::string newText = format::CleanString(ClipboardPull(), true, true, inputType != Multiline, inputType == Number || inputType == Numeric);
|
std::string newText = format::CleanString(ClipboardPull(), true, true, inputType != Multiline, inputType == Number || inputType == Numeric);
|
||||||
|
@@ -69,7 +69,6 @@ protected:
|
|||||||
std::string backingText;
|
std::string backingText;
|
||||||
std::string placeHolder;
|
std::string placeHolder;
|
||||||
|
|
||||||
virtual void selectAll();
|
|
||||||
virtual void cutSelection();
|
virtual void cutSelection();
|
||||||
virtual void pasteIntoSelection();
|
virtual void pasteIntoSelection();
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user