mirror of https://github.com/stella-emu/stella.git
make 'Cancel' work in command dialogs
This commit is contained in:
parent
951b13ed97
commit
39d3eefcef
|
@ -101,6 +101,10 @@ CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent)
|
|||
wid.push_back(bw);
|
||||
|
||||
addToFocusList(wid);
|
||||
|
||||
// We don't have a close/cancel button, but we still want the cancel
|
||||
// event to be processed
|
||||
processCancelWithoutWidget(true);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -233,6 +237,12 @@ void CommandDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
instance().eventHandler().handleEvent(event);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CommandDialog::processCancel()
|
||||
{
|
||||
instance().eventHandler().leaveMenuMode();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CommandDialog::updateSlot(int slot)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@ class CommandDialog : public Dialog
|
|||
void updateSlot(int slot);
|
||||
void updateTVFormat();
|
||||
void updatePalette();
|
||||
void processCancel() override;
|
||||
|
||||
// column 0
|
||||
ButtonWidget* myColorButton;
|
||||
|
|
|
@ -722,7 +722,7 @@ bool Dialog::handleNavEvent(Event::Type e)
|
|||
{
|
||||
// Some dialogs want the ability to cancel without actually having
|
||||
// a corresponding cancel button
|
||||
close();
|
||||
processCancel();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -159,6 +159,7 @@ class Dialog : public GuiObject
|
|||
bool focusOKButton = true);
|
||||
|
||||
void processCancelWithoutWidget(bool state) { _processCancel = state; }
|
||||
virtual void processCancel() { close(); }
|
||||
|
||||
/** Define the size (allowed) for the dialog. */
|
||||
void setSize(uInt32 w, uInt32 h, uInt32 max_w, uInt32 max_h);
|
||||
|
|
|
@ -104,6 +104,10 @@ MinUICommandDialog::MinUICommandDialog(OSystem& osystem, DialogContainer& parent
|
|||
wid.push_back(bw);
|
||||
|
||||
addToFocusList(wid);
|
||||
|
||||
// We don't have a close/cancel button, but we still want the cancel
|
||||
// event to be processed
|
||||
processCancelWithoutWidget(true);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -248,6 +252,12 @@ void MinUICommandDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
instance().eventHandler().handleEvent(event);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void MinUICommandDialog::processCancel()
|
||||
{
|
||||
instance().eventHandler().leaveMenuMode();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void MinUICommandDialog::updateSlot(int slot)
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@ class MinUICommandDialog : public Dialog
|
|||
void updateWinds();
|
||||
void updateTVFormat();
|
||||
void openSettings();
|
||||
void processCancel() override;
|
||||
|
||||
// column 0
|
||||
ButtonWidget* myColorButton;
|
||||
|
|
Loading…
Reference in New Issue