mirror of https://github.com/OpenTTD/OpenTTD.git
parent
c3d1264a4b
commit
fc9afb2d32
|
@ -517,7 +517,8 @@ void AskExitGame()
|
||||||
STR_QUIT_CAPTION,
|
STR_QUIT_CAPTION,
|
||||||
STR_QUIT_ARE_YOU_SURE_YOU_WANT_TO_EXIT_OPENTTD,
|
STR_QUIT_ARE_YOU_SURE_YOU_WANT_TO_EXIT_OPENTTD,
|
||||||
nullptr,
|
nullptr,
|
||||||
AskExitGameCallback
|
AskExitGameCallback,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,6 +537,7 @@ void AskExitToGameMenu()
|
||||||
STR_ABANDON_GAME_CAPTION,
|
STR_ABANDON_GAME_CAPTION,
|
||||||
(_game_mode != GM_EDITOR) ? STR_ABANDON_GAME_QUERY : STR_ABANDON_SCENARIO_QUERY,
|
(_game_mode != GM_EDITOR) ? STR_ABANDON_GAME_QUERY : STR_ABANDON_SCENARIO_QUERY,
|
||||||
nullptr,
|
nullptr,
|
||||||
AskExitToGameMenuCallback
|
AskExitToGameMenuCallback,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1218,15 +1218,16 @@ static WindowDesc _query_desc(
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
* The window is aligned to the centre of its parent.
|
||||||
* @param caption string shown as window caption
|
* @param caption string shown as window caption
|
||||||
* @param message string that will be shown for the window
|
* @param message string that will be shown for the window
|
||||||
* @param parent pointer to parent window, if this pointer is nullptr the parent becomes
|
* @param parent pointer to parent window, if this pointer is nullptr the parent becomes
|
||||||
* the main window WC_MAIN_WINDOW
|
* the main window WC_MAIN_WINDOW
|
||||||
* @param callback callback function pointer to set in the window descriptor
|
* @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();
|
if (parent == nullptr) parent = GetMainWindow();
|
||||||
|
|
||||||
|
@ -1240,5 +1241,6 @@ void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallback
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
new QueryWindow(&_query_desc, caption, message, parent, callback);
|
QueryWindow *q = new QueryWindow(&_query_desc, caption, message, parent, callback);
|
||||||
|
if (focus) SetFocusedWindow(q);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ DECLARE_ENUM_AS_BIT_SET(QueryStringFlags)
|
||||||
typedef void QueryCallbackProc(Window*, bool);
|
typedef void QueryCallbackProc(Window*, bool);
|
||||||
|
|
||||||
void ShowQueryString(StringID str, StringID caption, uint max_len, Window *parent, CharSetFilter afilter, QueryStringFlags flags);
|
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. */
|
/** The number of 'characters' on the on-screen keyboard. */
|
||||||
static const uint OSK_KEYBOARD_ENTRIES = 50;
|
static const uint OSK_KEYBOARD_ENTRIES = 50;
|
||||||
|
|
Loading…
Reference in New Issue