14 #define GETTEXT_DOMAIN "wesnoth-lib"
26 #ifdef GUI2_EXPERIMENTAL_LISTBOX
44 for(
size_t i = 0;
i < all_categories.size();
i++) {
46 if(all_categories[
i].substr(0,4) ==
"cat:")
48 else if(all_categories[
i] ==
"team")
52 for(
size_t i = 0;
i < hidden_categories.size();
i++) {
55 for(
size_t i = 0;
i < dc.
teams().size();
i++) {
57 const std::string label_cat_key =
"side:" + std::to_string(
i + 1);
63 if(team_name.empty()) {
66 if(team_name.empty()) {
67 team_name =
_(
"Unknown");
70 subst[
"side_number"] = std::to_string(
i + 1);
71 subst[
"name"] = team_name;
77 std::map<std::string, string_map> list_data;
78 tlistbox& cats_listbox = find_widget<tlistbox>(&window,
"label_types",
false);
81 const bool& visible = label_entry.second;
84 if(category.substr(0,5) ==
"side:") {
91 std::ostringstream sout;
92 sout <<
"<span color='#" << std::hex << which_color <<
"'>" << name <<
"</span>";
96 list_data[
"cat_name"][
"label"] =
name;
97 cats_listbox.
add_row(list_data);
104 if(category.substr(0,5) ==
"side:") {
105 tlabel& label = find_widget<tlabel>(
grid,
"cat_name",
false);
113 if(!window.
show(video))
return false;
114 std::vector<std::string> hidden_categories;
116 if(lbl.second ==
false) {
117 hidden_categories.push_back(lbl.first);
const std::vector< std::string > & all_categories() const
const std::vector< Uint32 > & tc_info(const std::string &name)
std::vector< std::string > & hidden_label_categories_ref()
bool show(CVideo &video, const unsigned auto_close_time=0)
Shows the window.
REGISTER_DIALOG(label_settings)
To lexical_cast(From value)
Lexical cast converts one type to another.
base class of top level items, the only item which needs to store the final canvases to draw on ...
A class inherited from ttext_box that displays its input as stars.
std::map< std::string, bool > all_labels
virtual void set_use_markup(bool use_markup)
This class stores all the data for a single 'side' (in game nomenclature).
std::map< std::string, t_string > labels_display
static UNUSEDNOWARN std::string _(const char *str)
unsigned get_item_count() const
Returns the number of items in the listbox.
void add_row(const string_map &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
tlabel_settings(display_context &dc)
const t_string & user_team_name() const
std::map< std::string, t_string > string_map
static bool execute(display_context &dc, CVideo &video)
The execute function.
virtual const std::vector< team > & teams() const =0
GLuint const GLchar * name
void pre_show(twindow &window)
Inherited from tdialog.
const std::string & side_name() const
virtual const std::vector< std::string > & hidden_label_categories() const =0
GLsizei const GLcharARB ** string
void toggle_category(twidget &box, std::string category)
Callback for toggling a checkbox state.
const tgrid * get_row_grid(const unsigned row) const
Returns the grid of the wanted row.