The Battle for Wesnoth  1.15.1+dev
edit_scenario.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2018 by Fabian Müller <fabianmueller5@gmx.de>
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #define GETTEXT_DOMAIN "wesnoth-lib"
16 
18 
20 #include "gui/widgets/settings.hpp"
21 #include "gui/widgets/text_box.hpp"
22 #include "gui/widgets/window.hpp"
23 
24 namespace gui2
25 {
26 namespace dialogs
27 {
28 
29 /*WIKI
30  * @page = GUIWindowDefinitionWML
31  * @order = 2_edit_scenario
32  *
33  * == Edit scenario ==
34  *
35  * Dialog for editing gamemap scenarios.
36  *
37  * @begin{table}{dialog_widgets}
38  *
39  * title & & label & m &
40  * Dialog title label. $
41  *
42  * label & & text_box & m &
43  * Input field for the map label. $
44  *
45  * team_only_toggle & & toggle_button & m &
46  * Checkbox for whether to make the label visible to the player's team
47  * only or not. $
48  *
49  * @end{table}
50  */
51 
52 REGISTER_DIALOG(editor_edit_scenario)
53 
55  std::string& id,
56  std::string& name,
57  std::string& description,
58  int& turns,
59  int& experience_modifier,
60  bool& victory_when_enemies_defeated,
61  bool& random_start_time)
62 {
63  register_text("id", true, id, true);
64  register_text("name", true, name, false);
65  register_text("description", true, description, false);
66  register_integer("turns", true, turns);
67  register_integer("experience_modifier", true, experience_modifier);
68  register_bool("victory_when_enemies_defeated",
69  true,
70  victory_when_enemies_defeated);
71  register_bool("random_start_time", true, random_start_time);
72 }
73 
75 {
76  win.add_to_tab_order(find_widget<text_box>(&win, "id", false, true));
77  win.add_to_tab_order(find_widget<text_box>(&win, "name", false, true));
78  win.add_to_tab_order(find_widget<text_box>(&win, "description", false, true));
79 }
80 
81 } // namespace dialogs
82 } // namespace gui2
This file contains the window object, this object is a top level container which has the event manage...
STL namespace.
Generic file dialog.
Definition: field-fwd.hpp:22
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48
This file contains the settings handling of the widget library.
virtual void pre_show(window &window) override
Inherited from modal_dialog.
Various uncategorised dialogs.
int turns()
Definition: game.cpp:572
void add_to_tab_order(widget *widget, int at=-1)
Add the widget to the tabbing order.
Definition: window.cpp:1300
bool random_start_time()
Definition: game.cpp:542
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:63