@@ -514,13 +514,14 @@ static void AskExitGameCallback(Window *
void AskExitGame()
{
ShowQuery(
STR_QUIT_CAPTION,
STR_QUIT_ARE_YOU_SURE_YOU_WANT_TO_EXIT_OPENTTD,
nullptr,
AskExitGameCallback
AskExitGameCallback,
true
);
}
static void AskExitToGameMenuCallback(Window *w, bool confirmed)
@@ -533,9 +534,10 @@ static void AskExitToGameMenuCallback(Wi
void AskExitToGameMenu()
STR_ABANDON_GAME_CAPTION,
(_game_mode != GM_EDITOR) ? STR_ABANDON_GAME_QUERY : STR_ABANDON_SCENARIO_QUERY,
AskExitToGameMenuCallback
AskExitToGameMenuCallback,
@@ -1215,21 +1215,22 @@ static WindowDesc _query_desc(
WC_CONFIRM_POPUP_QUERY, WC_NONE,
WDF_MODAL,
_nested_query_widgets, lengthof(_nested_query_widgets)
/**
* Show a modal confirmation window with standard 'yes' and 'no' buttons
* Show a confirmation window with standard 'yes' and 'no' buttons
* The window is aligned to the centre of its parent.
* @param caption string shown as window caption
* @param message string that will be shown for the window
* @param parent pointer to parent window, if this pointer is nullptr the parent becomes
* the main window WC_MAIN_WINDOW
* @param callback callback function pointer to set in the window descriptor
* @param focus whether the window should be focussed (by default false)
*/
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback)
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback, bool focus)
if (parent == nullptr) parent = GetMainWindow();
for (Window *w : Window::Iterate()) {
if (w->window_class != WC_CONFIRM_POPUP_QUERY) continue;
@@ -1237,8 +1238,9 @@ void ShowQuery(StringID caption, StringI
if (qw->parent != parent || qw->proc != callback) continue;
qw->Close();
break;
new QueryWindow(&_query_desc, caption, message, parent, callback);
QueryWindow *q = new QueryWindow(&_query_desc, caption, message, parent, callback);
if (focus) SetFocusedWindow(q);
@@ -26,13 +26,13 @@ enum QueryStringFlags {
DECLARE_ENUM_AS_BIT_SET(QueryStringFlags)
/** Callback procedure for the ShowQuery method. */
typedef void QueryCallbackProc(Window*, bool);
void ShowQueryString(StringID str, StringID caption, uint max_len, Window *parent, CharSetFilter afilter, QueryStringFlags flags);
void ShowQuery(StringID caption, StringID message, Window *w, QueryCallbackProc *callback);
void ShowQuery(StringID caption, StringID message, Window *w, QueryCallbackProc *callback, bool focus = false);
/** The number of 'characters' on the on-screen keyboard. */
static const uint OSK_KEYBOARD_ENTRIES = 50;
* The number of characters has to be OSK_KEYBOARD_ENTRIES. However, these
Status change: