The Battle for Wesnoth  1.19.9+dev
mp_create_game.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2025
3  by Mark de Wever <koraq@xs4all.nl>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
21 
23 
24 
25 namespace gui2
26 {
27 class toggle_button;
28 class listbox;
29 class menu_button;
30 
31 namespace dialogs
32 {
33 
35 {
36  typedef std::pair<level_type::type, std::string> level_type_info;
37 
38 public:
39  mp_create_game(saved_game& state, bool local_mode);
40 
41  /** The execute function. See @ref modal_dialog for more information. */
43 
44 private:
45  virtual const std::string& window_id() const override;
46 
47  virtual void pre_show() override;
48 
49  virtual void post_show() override;
50 
52  std::unique_ptr<mp_options_helper> options_manager_;
53 
56 
57  std::vector<level_type_info> level_types_;
58 
59  void update_games_list();
60  void display_games_of_type(level_type::type type, const std::string& level);
61 
63  void regenerate_random_map();
64 
65  /**
66  * All fields are also in the normal field vector, but they need to be
67  * manually controlled as well so add the pointers here as well.
68  */
69 
79 
88 
91 
93 
94  template<typename widget>
95  void on_filter_change(const std::string& id, bool do_select);
96 
97  void on_game_select();
98  void on_tab_select();
99  void on_era_select();
100  void on_mod_toggle(const std::string& id, toggle_button* sender);
102 
103  std::vector<std::string> get_active_mods();
104  void set_active_mods(const std::vector<std::string>& val);
105 
106  void sync_with_depcheck();
107 
108  void show_description(const std::string& new_description);
109 
110  void update_details();
111  void update_map_settings();
112 
113  void reset_timer_settings();
114 
115  /**
116  * Dialog exit hook to bring up the difficulty dialog when starting a campaign.
117  * This only fires when the retval is OK (ie, creating a game), meaning it does not fire
118  * when loading a saved game.
119  */
120  bool dialog_exit_hook();
121 
122  int convert_to_game_filtered_index(const unsigned int initial_index);
123 
124  void load_game_callback();
125 
127 };
128 
129 } // namespace dialogs
130 } // namespace gui2
Abstract base class for all modal dialogs.
std::pair< level_type::type, std::string > level_type_info
void display_games_of_type(level_type::type type, const std::string &level)
virtual void post_show() override
Actions to be taken after the window has been shown.
void set_active_mods(const std::vector< std::string > &val)
void show_description(const std::string &new_description)
virtual void pre_show() override
Actions to be taken before showing the window.
void on_mod_toggle(const std::string &id, toggle_button *sender)
mp_create_game(saved_game &state, bool local_mode)
std::unique_ptr< mp_options_helper > options_manager_
std::vector< level_type_info > level_types_
DEFINE_SIMPLE_EXECUTE_WRAPPER(mp_create_game)
The execute function.
ng::create_engine create_engine_
void on_filter_change(const std::string &id, bool do_select)
std::vector< std::string > get_active_mods()
virtual const std::string & window_id() const override
The ID of the window to build.
bool dialog_exit_hook()
Dialog exit hook to bring up the difficulty dialog when starting a campaign.
int convert_to_game_filtered_index(const unsigned int initial_index)
field_bool * use_map_settings_
All fields are also in the normal field vector, but they need to be manually controlled as well so ad...
Specialized field class for boolean.
Definition: field.hpp:488
Template class to implement the generic field implementation.
Definition: field.hpp:245
The listbox class.
Definition: listbox.hpp:41
static const std::string & type()
Static type getter that does not rely on the widget being constructed.
Various uncategorised dialogs.
Generic file dialog.