This commit is contained in:
Benau 2021-11-26 18:29:22 +08:00
parent 6b022368cf
commit b4411b11fe
3 changed files with 14 additions and 9 deletions

View File

@ -40,14 +40,14 @@ MessageDialog::MessageDialog(const irr::core::stringw &msg,
MessageDialogType type,
IConfirmDialogListener* listener,
bool own_listener, bool from_queue,
float width, float height)
float width, float height, bool focus_on_cancel)
: ModalDialog(width, height)
{
m_msg = msg;
m_type = type;
m_listener = listener;
m_own_listener = own_listener;
m_focus_on_cancel = false;
m_focus_on_cancel = focus_on_cancel;
doInit(from_queue);
} // MessageDialog(stringw, type, listener, own_listener)
@ -58,14 +58,15 @@ MessageDialog::MessageDialog(const irr::core::stringw &msg,
* loadFromFile() is not called (it will be called when the dialog
* is finally being removed from the queue and shown).
*/
MessageDialog::MessageDialog(const irr::core::stringw &msg, bool from_queue)
MessageDialog::MessageDialog(const irr::core::stringw &msg, bool from_queue,
bool focus_on_cancel)
: ModalDialog(0.6f, 0.6f)
{
m_msg = msg;
m_type = MessageDialog::MESSAGE_DIALOG_OK;
m_listener = NULL;
m_own_listener = false;
m_focus_on_cancel = false;
m_focus_on_cancel = focus_on_cancel;
if (!from_queue) doInit(false);
} // MessageDialog(stringw)

View File

@ -89,14 +89,16 @@ public:
*/
MessageDialog(const irr::core::stringw &msg, MessageDialogType type,
IConfirmDialogListener* listener, bool delete_listener,
bool from_queue = false, float width = 0.6f, float height = 0.6f);
bool from_queue = false, float width = 0.6f, float height = 0.6f,
bool focus_on_cancel = false);
/**
* Variant of MessageDialog where cancelling is not possible (i.e. just shows a message box with OK)
* \param msg Message to display in the dialog
*/
MessageDialog(const irr::core::stringw &msg, bool from_queue = false);
MessageDialog(const irr::core::stringw &msg, bool from_queue = false,
bool focus_on_cancel = false);
~MessageDialog();
virtual void onEnterPressedInternal() OVERRIDE;

View File

@ -528,7 +528,9 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
else if (action == "right") // Abort
{
new MessageDialog(_("Do you really want to abort the Grand Prix?"),
MessageDialog::MESSAGE_DIALOG_CONFIRM, this, false);
MessageDialog::MESSAGE_DIALOG_CONFIRM, this,
/*delete_listener*/false, /*from_queue*/false,
/*width*/0.6f, /*height*/0.6f, /*focus_on_cancel*/true);
}
else if (!getWidget(action.c_str())->isVisible())
{