mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-08 09:26:28 +02:00
Make Copy and Cut buttons disappear when no text is selected (#730)
This commit is contained in:
@@ -503,7 +503,25 @@ void Textbox::OnTextInput(String text)
|
|||||||
|
|
||||||
void Textbox::OnMouseClick(int x, int y, unsigned button)
|
void Textbox::OnMouseClick(int x, int y, unsigned button)
|
||||||
{
|
{
|
||||||
|
if (button == SDL_BUTTON_RIGHT)
|
||||||
|
{
|
||||||
|
if (HasSelection())
|
||||||
|
{
|
||||||
|
menu->RemoveItem(0);
|
||||||
|
menu->RemoveItem(1);
|
||||||
|
menu->RemoveItem(2);
|
||||||
|
menu->AddItem(ContextMenuItem("Cut", 1, true));
|
||||||
|
menu->AddItem(ContextMenuItem("Copy", 0, true));
|
||||||
|
menu->AddItem(ContextMenuItem("Paste", 2, true));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menu->RemoveItem(0);
|
||||||
|
menu->RemoveItem(1);
|
||||||
|
menu->RemoveItem(2);
|
||||||
|
menu->AddItem(ContextMenuItem("Paste", 2, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (button != SDL_BUTTON_RIGHT)
|
if (button != SDL_BUTTON_RIGHT)
|
||||||
{
|
{
|
||||||
mouseDown = true;
|
mouseDown = true;
|
||||||
|
Reference in New Issue
Block a user