The Battle for Wesnoth  1.15.9+dev
edit_side.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 
19 #include "gui/auxiliary/field.hpp"
21 #include "gui/widgets/settings.hpp"
22 
23 #include <functional>
24 
25 namespace gui2
26 {
27 namespace dialogs
28 {
29 
30 REGISTER_DIALOG(editor_edit_side)
31 
33  : controller_(info.controller)
34  , share_vision_(info.share_vision)
35 {
36  register_label("side_number", true, std::to_string(info.side), true);
37 
38  register_text("team_name", true, info.id, true);
39  register_text("user_team_name", true, info.name, false);
40 
41  register_integer("gold", true, info.gold);
42  register_integer("income", true, info.income);
43 
44  register_integer("village_income", true, info.village_income);
45  register_integer("village_support", true, info.village_support);
46 
47  register_bool("fog", true, info.fog);
48  register_bool("shroud", true, info.shroud);
49 
50  register_bool("no_leader", true, info.no_leader);
51  register_bool("hidden", true, info.hidden);
52 }
53 
55 {
56  controller_group.add_member(find_widget<toggle_button>(&window, "controller_human", false, true), team::CONTROLLER::HUMAN);
57  controller_group.add_member(find_widget<toggle_button>(&window, "controller_ai", false, true), team::CONTROLLER::AI);
58  controller_group.add_member(find_widget<toggle_button>(&window, "controller_null", false, true), team::CONTROLLER::EMPTY);
59 
61 
62  vision_group.add_member(find_widget<toggle_button>(&window, "vision_all", false, true), team::SHARE_VISION::ALL);
63  vision_group.add_member(find_widget<toggle_button>(&window, "vision_shroud", false, true), team::SHARE_VISION::SHROUD);
64  vision_group.add_member(find_widget<toggle_button>(&window, "vision_null", false, true), team::SHARE_VISION::NONE);
65 
67 
68  window.add_to_tab_order(find_widget<text_box>(&window, "team_name", false, true));
69  window.add_to_tab_order(find_widget<text_box>(&window, "user_team_name", false, true));
70 }
71 
73 {
76 }
77 
78 } // namespace dialogs
79 } // namespace gui2
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
Definition: edit_side.cpp:72
Dialog for editing gamemap sides.
Definition: edit_side.hpp:38
logger & info()
Definition: log.cpp:91
T get_active_member_value()
Returns the value paired with the currently actively toggled member of the group. ...
Definition: group.hpp:95
team::SHARE_VISION & share_vision_
Definition: edit_side.hpp:53
Implements some helper classes to ease adding fields to a dialog and hide the synchronization needed...
Generic file dialog.
Definition: field-fwd.hpp:22
virtual void pre_show(window &window) override
The execute function.
Definition: edit_side.cpp:54
This file contains the settings handling of the widget library.
Manage the empty-palette in the editor.
Definition: action.cpp:29
Various uncategorised dialogs.
group< team::SHARE_VISION > vision_group
Definition: edit_side.hpp:54
void add_member(selectable_item *w, const T &value)
Adds a widget/value pair to the group map.
Definition: group.hpp:41
Default, unset return value.
Definition: retval.hpp:31
void add_to_tab_order(widget *widget, int at=-1)
Add the widget to the tabbing order.
Definition: window.cpp:1291
team::CONTROLLER & controller_
Definition: edit_side.hpp:50
base class of top level items, the only item which needs to store the final canvases to draw on...
Definition: window.hpp:64
group< team::CONTROLLER > controller_group
Definition: edit_side.hpp:51
void set_member_states(const T &value)
Sets the toggle values for all widgets besides the one associated with the specified value to false...
Definition: group.hpp:110