Make Copy and Cut buttons disappear when no text is selected (#730)
This commit is contained in:
parent
c73dfe8ca0
commit
d6de7e2ba8
@ -503,7 +503,25 @@ void Textbox::OnTextInput(String text)
|
||||
|
||||
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)
|
||||
{
|
||||
mouseDown = true;
|
||||
|
Loading…
Reference in New Issue
Block a user