15 #define GETTEXT_DOMAIN "wesnoth-lib"
45 const std::vector<std::string>& hidden_categories = viewer_.hidden_label_categories();
47 for(
const std::string& cat : all_categories) {
48 all_labels_[cat] =
true;
51 if(cat.substr(0, 4) ==
"cat:") {
52 labels_display_[cat] = cat.substr(4);
53 }
else if(cat ==
"team") {
54 labels_display_[cat] =
_(
"Team Labels");
58 for(
const std::string& hidden_cat : hidden_categories) {
59 all_labels_[hidden_cat] =
false;
62 for(std::size_t
i = 0;
i < viewer_.teams().
size();
i++) {
64 const std::string label_cat_key =
"side:" + std::to_string(
i + 1);
67 labels_display_[label_cat_key] =
"";
73 if(team_name.empty()) {
77 if(team_name.empty()) {
78 team_name =
_(
"Unknown");
82 subst[
"side_number"] = std::to_string(
i + 1);
83 subst[
"name"] = team_name;
84 labels_display_[label_cat_key] =
VGETTEXT(
"Side $side_number ($name)", subst);
90 listbox& cats_listbox = find_widget<listbox>(&
window,
"label_types",
false);
94 const std::string& category = label_entry.first;
95 const bool visible = label_entry.second;
98 if(category.substr(0, 5) ==
"side:") {
104 const int team = std::stoi(category.substr(5)) - 1;
110 list_data[
"cat_name"][
"label"] = name;
114 status.set_value(visible);
118 if(category.substr(0, 5) ==
"side:") {
119 label& cat_name = find_widget<label>(
grid,
"cat_name",
false);
128 std::vector<std::string> hidden_categories;
131 if(lbl.second ==
false) {
132 hidden_categories.push_back(lbl.first);
Abstract class for exposing game data that doesn't depend on the GUI, however which for historical re...
virtual const std::vector< std::string > & hidden_label_categories() const =0
virtual const std::vector< team > & teams() const =0
static display * get_singleton()
Returns the display object if a display object exists.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
std::map< std::string, t_string > labels_display_
display_context & viewer_
void toggle_category(widget &box, const std::string &category)
Callback for toggling a checkbox state.
std::map< std::string, bool > all_labels_
The execute function.
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
Abstract base class for all modal dialogs.
int get_retval() const
Returns the cached window exit code.
A label displays a text, the text can be wrapped but no scrollbars are provided.
grid & add_row(const widget_item &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
base class of top level items, the only item which needs to store the final canvases to draw on.
status
The status of the window.
const std::vector< std::string > & all_categories() const
This class stores all the data for a single 'side' (in game nomenclature).
const std::string & side_name() const
const t_string & user_team_name() const
static std::string _(const char *str)
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
std::string span_color(const color_t &color)
Returns a Pango formatting string using the provided color_t object.
const std::vector< color_t > & tc_info(const std::string &name)
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification &signal)
Connects a signal handler for getting a notification upon modification.
std::map< std::string, widget_item > widget_data
@ OK
Dialog was closed with the OK button.
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
std::map< std::string, t_string > string_map
This file contains the settings handling of the widget library.
The basic class for representing 8-bit RGB or RGBA colour values.