15 #define GETTEXT_DOMAIN "wesnoth-lib" 62 #define ERR_CF LOG_STREAM(err, log_config) 63 #define WRN_CF LOG_STREAM(warn, log_config) 81 set_allow_plugin_skip(
false);
96 auto b = find_widget<button>(&win, id,
false,
false);
114 gui2::dialogs::screenshot_notification::display(filename, screenshot);
133 std::string
message =
"Hello world.";
135 for(
int i = 0;
i < 0; ++
i) {
136 message +=
" More greetings.";
154 std::bind(debug_tooltip, std::ref(win), std::placeholders::_3, std::placeholders::_5),
179 ERR_CF <<
"No title image defined" << std::endl;
185 ERR_CF <<
"No title background image defined" << std::endl;
198 if(
label* version_label = find_widget<label>(&win,
"revision_number",
false,
false)) {
199 version_label->set_label(version_string);
202 win.get_canvas(0).set_variable(
"revision_number",
wfl::variant(version_string));
207 multi_page* tip_pages = find_widget<multi_page>(&win,
"tips",
false,
false);
209 if(tip_pages !=
nullptr) {
212 WRN_CF <<
"There are no tips of day available." << std::endl;
214 for(
const auto&
tip : tips) {
216 std::map<std::string, string_map> page;
218 widget[
"use_markup"] =
"true";
220 widget[
"label"] =
tip.text();
221 page.emplace(
"tip", widget);
223 widget[
"label"] =
tip.source();
224 page.emplace(
"source", widget);
243 gui2::dialogs::help_browser::display();
314 }
catch(
const std::runtime_error&
e) {
323 gui2::dialogs::preferences_dialog::display();
336 find_widget<button>(&win,
"quit",
false,
true);
344 auto clock = find_widget<button>(&win,
"clock",
false,
false);
358 if(tip_pages ==
nullptr) {
406 std::vector<std::string>
options;
408 if(!sc[
"is_unit_test"].to_bool(
false)) {
409 options.emplace_back(sc[
"id"]);
413 std::sort(options.begin(), options.end());
418 int choice = dlg.selected_index();
438 if(!gui2::dialogs::mp_host_game_prompt::execute()) {
444 case decltype(dlg)::choice::JOIN:
448 case decltype(dlg)::choice::CONNECT:
452 case decltype(dlg)::choice::HOST:
456 case decltype(dlg)::choice::LOCAL:
469 std::vector<config> cores;
471 cores.push_back(core);
474 current = cores.size() - 1;
479 if(core_dlg.
show()) {
bool new_widgets
Do we wish to use the new library or not.
void remove()
Removes a tip.
void show_debug_clock_window()
Shows the debug clock.
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
void show_help(const std::string &show_topic, int xloc, int yloc)
Open the help browser, show topic with id show_topic.
std::string get_next_filename(const std::string &name, const std::string &extension)
Get the next free filename using "name + number (3 digits) + extension" maximum 1000 files then start...
std::vector< game_tip > tips
Main class to show messages to the user.
void register_hotkey(const hotkey::HOTKEY_COMMAND id, const hotkey_function &function)
Registers a hotkey.
grid & add_page(const string_map &item)
Adds single page to the grid.
void set_variable(const std::string &key, const wfl::variant &value)
An SDL resize request, coordinate is the new window size.
This class implements the title screen.
void set_click_dismiss(const bool click_dismiss)
void button_callback_cores()
std::string get_screenshot_dir()
void set_escape_disabled(const bool escape_disabled)
Disable the escape key.
static CVideo & get_singleton()
window * get_window() const
Returns a pointer to the dialog's window.
A label displays a text, the text can be wrapped but no scrollbars are provided.
int get_selected_page() const
Returns the selected page.
static std::string _(const char *str)
bool show(const unsigned auto_close_time=0)
Shows the window.
static void launch_lua_console()
surface clone() const
Makes a copy of this surface.
surface & getSurface()
Returns a reference to the framebuffer.
static void display(lua_kernel_base *lk)
Display a new console, using given video and lua kernel.
static game_config_manager * get()
const std::vector< game_config::server_info > & builtin_servers_list()
A simple one-column listbox with OK and Cancel buttons.
This file contains the settings handling of the widget library.
void connect_signal_mouse_left_click(dispatcher &dispatcher, const signal_function &signal)
Connects a signal handler for a left mouse button click.
std::string game_title_background
void set_test(const std::string &id)
void set_core_id(const std::string &core_id)
void select_mp_server(const std::string &server)
static lg::log_domain log_config("config")
std::string game_logo_background
const char * what() const noexcept
bool manage_addons()
Shows the add-ons server connection dialog, for access to the various management front-ends.
Various uncategorised dialogs.
choice get_choice() const
int mp_server_warning_disabled()
std::enable_if_t< is_general_event(E)> connect_signal(const signal_function &signal, const queue_position position=back_child)
Connect a signal for callback in set_event.
const std::string revision
void load_game_config_for_create(bool is_mp, bool is_test=false)
Clock to test the draw events.
Game configuration data as global variables.
void select_page(const unsigned page, const bool select=true)
Selects a page.
void button_callback_multiplayer()
Contains the gui2 timer routines.
Declarations for File-IO.
void set_retval(const int retval, const bool close_window=true)
Sets there return value of the window.
static int sort(lua_State *L)
unsigned get_page_count() const
Returns the number of pages.
int get_retval() const
Returns the cached window exit code.
This shows the dialog to select the kind of MP game the user wants to play.
A multi page is a control that contains several 'pages' of which only one is visible.
void update_tip(const bool previous)
Updates the tip of day widget.
void hotkey_callback_select_tests()
Standard logging facilities (interface).
std::unique_ptr< modeless_dialog > debug_clock_
Holds the debug clock dialog.
void show_error_message(const std::string &msg, bool message_use_markup)
Shows an error message to the user.
This shows the dialog which allows the user to choose which core to play.
std::vector< game_tip > shuffle(const std::vector< game_tip > &tips)
Shuffles the tips.
virtual void pre_show(window &window) override
Inherited from modal_dialog.
Dialog was closed with the OK button.
map_location coordinate
Contains an x and y coordinate used for starting positions in maps.
A config object defines a single node in a WML file, with access to child nodes.
static void make_screenshot()
void set_retval(int retval)
Convenience wrapper to set the window's exit code.
base class of top level items, the only item which needs to store the final canvases to draw on...
std::function< void()> btn_callback
static void register_button(window &win, const std::string &id, hotkey::HOTKEY_COMMAND hk, btn_callback callback)
void show(const std::string &window_id, const t_string &message, const point &mouse, const SDL_Rect &source_rect)
Shows a tip.
bool show_debug_clock_button
Do we wish to show the button for the debug clock.
An SDL mouse motion event.
void set_enter_disabled(const bool enter_disabled)
Disable the enter key.