The Battle for Wesnoth  1.17.17+dev
edit_scenario.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2023
3  by Fabian Müller <fabianmueller5@gmx.de>
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 #define GETTEXT_DOMAIN "wesnoth-lib"
17 
19 
21 #include "gui/widgets/settings.hpp"
22 #include "gui/widgets/text_box.hpp"
23 #include "gui/widgets/window.hpp"
24 
25 namespace gui2::dialogs
26 {
27 
28 REGISTER_DIALOG(editor_edit_scenario)
29 
31  std::string& id,
32  std::string& name,
33  std::string& description,
34  int& turns,
35  int& experience_modifier,
36  bool& victory_when_enemies_defeated,
37  bool& random_start_time)
38  : modal_dialog(window_id())
39 {
40  register_text("id", true, id, true);
41  register_text("name", true, name, false);
42  register_text("description", true, description, false);
43  register_integer("turns", true, turns);
44  register_integer("experience_modifier", true, experience_modifier);
45  register_bool("victory_when_enemies_defeated",
46  true,
47  victory_when_enemies_defeated);
48  register_bool("random_start_time", true, random_start_time);
49 }
50 
52 {
53  win.add_to_tab_order(find_widget<text_box>(&win, "id", false, true));
54  win.add_to_tab_order(find_widget<text_box>(&win, "name", false, true));
55  win.add_to_tab_order(find_widget<text_box>(&win, "description", false, true));
56 }
57 
58 } // namespace dialogs
Dialog for editing gamemap scenarios.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
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:67
void add_to_tab_order(widget *widget, int at=-1)
Add the widget to the tabbing order.
Definition: window.cpp:1148
This file contains the window object, this object is a top level container which has the event manage...
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
bool random_start_time()
Definition: game.cpp:515
int turns()
Definition: game.cpp:545
This file contains the settings handling of the widget library.