15 #define GETTEXT_DOMAIN "wesnoth-lib"
43 const std::vector<std::string>& hidden_categories = viewer_.hidden_label_categories();
45 for(
const std::string& cat : all_categories) {
46 all_labels_[cat] =
true;
49 if(cat.substr(0, 4) ==
"cat:") {
50 labels_display_[cat] = cat.substr(4);
51 }
else if(cat ==
"team") {
52 labels_display_[cat] =
_(
"Team Labels");
56 for(
const std::string& hidden_cat : hidden_categories) {
57 all_labels_[hidden_cat] =
false;
60 for(std::size_t
i = 0;
i < viewer_.teams().
size();
i++) {
62 const std::string label_cat_key =
"side:" + std::to_string(
i + 1);
65 labels_display_[label_cat_key] =
"";
71 if(team_name.empty()) {
75 if(team_name.empty()) {
76 team_name =
_(
"Unknown");
80 subst[
"side_number"] = std::to_string(
i + 1);
81 subst[
"name"] = team_name;
82 labels_display_[label_cat_key] =
VGETTEXT(
"Side $side_number ($name)", subst);
88 listbox& cats_listbox = find_widget<listbox>(&
window,
"label_types",
false);
92 const std::string& category = label_entry.first;
93 const bool visible = label_entry.second;
96 if(category.substr(0, 5) ==
"side:") {
102 const int team = std::stoi(category.substr(5)) - 1;
108 list_data[
"cat_name"][
"label"] = name;
112 status.set_value(visible);
116 if(category.substr(0, 5) ==
"side:") {
117 label& cat_name = find_widget<label>(
grid,
"cat_name",
false);
126 std::vector<std::string> hidden_categories;
129 if(lbl.second ==
false) {
130 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 text that 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)
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(std::string_view name)
REGISTER_DIALOG(tod_new_schedule)
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
The basic class for representing 8-bit RGB or RGBA colour values.