The Battle for Wesnoth  1.19.0-dev
generate_map.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2024
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 
19 #include <optional>
20 
21 #include <cstdint>
22 #include <memory>
23 
24 class map_generator;
25 
26 namespace gui2
27 {
28 
29 namespace dialogs
30 {
31 
32 /**
33  * @ingroup GUIWindowDefinitionWML
34  *
35  * The dialog for selecting which random generator to use in the editor.
36  * Key |Type |Mandatory|Description
37  * ------------------|--------------|---------|-----------
38  * generators_list | @ref listbox |yes |Listbox displaying known map generators.
39  * settings | @ref button |yes |When clicked this button opens the generator settings dialog.
40  * seed_textbox | text_box |yes |Allows entering a seed for the map generator.
41  */
43 {
44 public:
45  explicit editor_generate_map(std::vector<std::unique_ptr<map_generator>>& mg);
46 
47  std::vector<std::unique_ptr<map_generator>>& get_map_generators()
48  {
49  return map_generators_;
50  }
51 
53 
55 
56  std::optional<uint32_t> get_seed();
57 
58 private:
59  virtual const std::string& window_id() const override;
60 
61  virtual void pre_show(window& window) override;
62 
63  /** Callback for generator list selection changes. */
64  void do_generator_selected();
65 
66  /** Callback for the generator settings button. */
67  void do_settings();
68 
69  /** Available map generators */
70  std::vector<std::unique_ptr<map_generator>>& map_generators_;
71 
72  /** Last used map generator, must be in map_generators_ */
74 
75  /** Current map generator index */
77 
78  /** random seed integer input*/
79  std::string random_seed_;
80 };
81 
82 } // namespace dialogs
83 } // namespace gui2
The dialog for selecting which random generator to use in the editor.
std::vector< std::unique_ptr< map_generator > > & map_generators_
Available map generators.
int current_map_generator_
Current map generator index.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
editor_generate_map(std::vector< std::unique_ptr< map_generator >> &mg)
void do_generator_selected()
Callback for generator list selection changes.
void do_settings()
Callback for the generator settings button.
std::optional< uint32_t > get_seed()
std::vector< std::unique_ptr< map_generator > > & get_map_generators()
map_generator * last_map_generator_
Last used map generator, must be in map_generators_.
virtual const std::string & window_id() const override
The ID of the window to build.
std::string random_seed_
random seed integer input
void select_map_generator(map_generator *mg)
map_generator * get_selected_map_generator()
Abstract base class for all modal dialogs.
base class of top level items, the only item which needs to store the final canvases to draw on.
Definition: window.hpp:63
Various uncategorised dialogs.
Generic file dialog.