mirror of https://github.com/stella-emu/stella.git
added selection reset for all widgets derived from EditableWidget
This commit is contained in:
parent
c8c70ee54b
commit
c894d8c080
|
@ -259,6 +259,7 @@ void DataGridWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount
|
|||
if (!isEnabled())
|
||||
return;
|
||||
|
||||
resetSelection();
|
||||
// First check whether the selection changed
|
||||
int newSelectedItem;
|
||||
newSelectedItem = findItem(x, y);
|
||||
|
|
|
@ -235,6 +235,7 @@ void RomListWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
|
|||
if (!isEnabled())
|
||||
return;
|
||||
|
||||
resetSelection();
|
||||
// Grab right mouse button for context menu, left for selection/edit mode
|
||||
if(b == MouseButton::RIGHT)
|
||||
{
|
||||
|
|
|
@ -118,12 +118,15 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
|||
if(StellaModTest::isAlt(mod))
|
||||
return true;
|
||||
|
||||
// Handle Control and Control-Shift keys
|
||||
if(StellaModTest::isControl(mod) && handleControlKeys(key, mod))
|
||||
return true;
|
||||
|
||||
// Handle Shift keys
|
||||
if(StellaModTest::isShift(mod) && handleShiftKeys(key))
|
||||
return true;
|
||||
|
||||
// Handle keys without modifiers
|
||||
return handleNormalKeys(key);
|
||||
}
|
||||
|
||||
|
|
|
@ -110,6 +110,10 @@ class EditableWidget : public Widget, public CommandSender
|
|||
bool _editable{true};
|
||||
string _editString;
|
||||
int _caretPos{0};
|
||||
// Size of current selected text
|
||||
// 0 = no selection
|
||||
// <0 = selected left of caret
|
||||
// >0 = selected right of caret
|
||||
int _selectSize{0};
|
||||
|
||||
protected:
|
||||
|
|
|
@ -205,6 +205,7 @@ void ListWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
|
|||
if (!isEnabled())
|
||||
return;
|
||||
|
||||
resetSelection();
|
||||
// First check whether the selection changed
|
||||
int newSelectedItem;
|
||||
newSelectedItem = findItem(x, y);
|
||||
|
|
|
@ -117,6 +117,7 @@ const Variant& PopUpWidget::getSelectedTag() const
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
|
||||
{
|
||||
resetSelection();
|
||||
if(!isEditable() || x > _w - dropDownWidth(_font))
|
||||
{
|
||||
if(isEnabled() && !myMenu->isVisible())
|
||||
|
|
Loading…
Reference in New Issue