GUI2: added/renamed widget data types aliases
Also moved the string_map alias into the GUI2 namespace and renamed it widget_item. It's the same as utils::string_map, but this makes its purpose clearer.
This commit is contained in:
parent
e62ec5f806
commit
85e9b40495
70 changed files with 186 additions and 191 deletions
|
@ -66,8 +66,8 @@ void addon_uninstall_list::pre_show(window& window)
|
|||
this->ids_.push_back(id);
|
||||
this->selections_[id] = false;
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map column;
|
||||
widget_data data;
|
||||
widget_item column;
|
||||
|
||||
column["label"] = title;
|
||||
data.emplace("name", column);
|
||||
|
|
|
@ -90,8 +90,8 @@ void campaign_difficulty::pre_show(window& window)
|
|||
window.keyboard_capture(&list);
|
||||
|
||||
for(const config& d : difficulties_.child_range("difficulty")) {
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = d["image"];
|
||||
data.emplace("icon", item);
|
||||
|
|
|
@ -225,8 +225,8 @@ void campaign_selection::pre_show(window& window)
|
|||
add_campaign_to_tree(window, campaign);
|
||||
|
||||
/*** Add detail item ***/
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = campaign["description"];
|
||||
item["use_markup"] = "true";
|
||||
|
@ -276,8 +276,8 @@ void campaign_selection::pre_show(window& window)
|
|||
void campaign_selection::add_campaign_to_tree(window& window, const config& campaign)
|
||||
{
|
||||
tree_view& tree = find_widget<tree_view>(&window, "campaign_tree", false);
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = campaign["icon"];
|
||||
data.emplace("icon", item);
|
||||
|
|
|
@ -93,8 +93,8 @@ void core_selection::pre_show(window& window)
|
|||
for(const auto & core : cores_)
|
||||
{
|
||||
/*** Add list item ***/
|
||||
string_map list_item;
|
||||
std::map<std::string, string_map> list_item_item;
|
||||
widget_item list_item;
|
||||
widget_data list_item_item;
|
||||
|
||||
list_item["label"] = core["image"];
|
||||
list_item_item.emplace("image", list_item);
|
||||
|
@ -106,8 +106,8 @@ void core_selection::pre_show(window& window)
|
|||
assert(grid);
|
||||
|
||||
/*** Add detail item ***/
|
||||
string_map detail_item;
|
||||
std::map<std::string, string_map> detail_page;
|
||||
widget_item detail_item;
|
||||
widget_data detail_page;
|
||||
|
||||
detail_item["label"] = core["description"];
|
||||
detail_item["use_markup"] = "true";
|
||||
|
|
|
@ -154,8 +154,8 @@ void debug_clock::update_time(const bool force)
|
|||
}
|
||||
|
||||
const std::map<std::string, std::string> tags;
|
||||
std::map<std::string, string_map> item_data;
|
||||
string_map item;
|
||||
widget_data item_data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = std::to_string(second_stamp);
|
||||
item_data.emplace("time", item);
|
||||
|
|
|
@ -90,7 +90,7 @@ void depcheck_select_new::pre_show(window& window)
|
|||
|
||||
for(const auto & item : items_)
|
||||
{
|
||||
std::map<std::string, string_map> data;
|
||||
widget_data data;
|
||||
data["option"]["label"] = item;
|
||||
|
||||
items.add_row(data);
|
||||
|
|
|
@ -120,8 +120,8 @@ void drop_down_menu::pre_show(window& window)
|
|||
* [/entry]
|
||||
*/
|
||||
for(const auto& entry : items_) {
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
const bool has_image_key = entry.has_attribute("image");
|
||||
const bool has_ckbox_key = entry.has_attribute("checkbox");
|
||||
|
|
|
@ -108,7 +108,7 @@ void editor_generate_map::pre_show(window& window)
|
|||
listbox& list = find_widget<listbox>(&window, "generators_list", false);
|
||||
window.keyboard_capture(&list);
|
||||
|
||||
std::map<std::string, string_map> lrow;
|
||||
widget_data lrow;
|
||||
for(const auto & gen : map_generators_)
|
||||
{
|
||||
assert(gen);
|
||||
|
|
|
@ -77,8 +77,8 @@ void editor_set_starting_position::pre_show(window& window)
|
|||
listbox& list = find_widget<listbox>(&window, "listbox", false);
|
||||
window.keyboard_capture(&list);
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map column;
|
||||
widget_data data;
|
||||
widget_item column;
|
||||
|
||||
column["label"] = _("player^None");
|
||||
data.emplace("player", column);
|
||||
|
|
|
@ -196,7 +196,7 @@ void file_dialog::pre_show(window& window)
|
|||
bookmark_paths_.clear();
|
||||
current_bookmark_ = user_bookmarks_begin_ = -1;
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
widget_data data;
|
||||
|
||||
for(const auto& pinfo : bookmarks) {
|
||||
bookmark_paths_.push_back(pinfo.path);
|
||||
|
@ -528,7 +528,7 @@ void file_dialog::push_fileview_row(listbox& filelist, const std::string& name,
|
|||
std::string label = name;
|
||||
utils::ellipsis_truncate(label, FILE_DIALOG_MAX_ENTRY_LENGTH);
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
widget_data data;
|
||||
data["icon"]["label"] = icon;
|
||||
data["file"]["label"] = label;
|
||||
|
||||
|
@ -667,7 +667,7 @@ void file_dialog::on_bookmark_add_cmd(window& window)
|
|||
user_bookmarks_begin_ = top_bookmark;
|
||||
}
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
widget_data data;
|
||||
data["bookmark"]["label"] = label;
|
||||
bookmarks_bar.add_row(data);
|
||||
|
||||
|
|
|
@ -120,8 +120,8 @@ void game_load::pre_show(window& window)
|
|||
list.clear();
|
||||
|
||||
for(const auto& game : games_) {
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
std::string name = game.name();
|
||||
utils::ellipsis_truncate(name, 40);
|
||||
|
@ -173,8 +173,8 @@ void game_load::display_savegame(window& window)
|
|||
leader_list.clear();
|
||||
|
||||
for(const auto& leader : summary_.child_range("leader")) {
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
// First, we evaluate whether the leader image as provided exists.
|
||||
// If not, we try getting a binary path-independent path. If that still doesn't
|
||||
|
|
|
@ -79,8 +79,8 @@ void game_stats::pre_show(window& window)
|
|||
continue;
|
||||
}
|
||||
|
||||
std::map<std::string, string_map> row_data_stats;
|
||||
string_map column_stats;
|
||||
widget_data row_data_stats;
|
||||
widget_item column_stats;
|
||||
|
||||
const bool known = viewing_team_.knows_about_team(team.side() - 1);
|
||||
const bool enemy = viewing_team_.is_enemy(team.side());
|
||||
|
@ -161,8 +161,8 @@ void game_stats::pre_show(window& window)
|
|||
//
|
||||
// Settings list
|
||||
//
|
||||
std::map<std::string, string_map> row_data_settings;
|
||||
string_map column_settings;
|
||||
widget_data row_data_settings;
|
||||
widget_item column_settings;
|
||||
|
||||
column_settings["use_markup"] = "true";
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ game_version::game_version()
|
|||
|
||||
void game_version::pre_show(window& window)
|
||||
{
|
||||
string_map i18n_syms;
|
||||
widget_item i18n_syms;
|
||||
|
||||
//
|
||||
// General information.
|
||||
|
@ -201,7 +201,7 @@ void game_version::pre_show(window& window)
|
|||
// Build info tab.
|
||||
//
|
||||
|
||||
std::map<std::string, string_map> list_data;
|
||||
widget_data list_data;
|
||||
|
||||
listbox& deps_listbox
|
||||
= find_widget<listbox>(&window, "deps_listbox", false);
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
|
||||
stuff_list_adder& widget(const std::string& ref, const std::string& label, bool markup = false)
|
||||
{
|
||||
string_map& item = data_[ref];
|
||||
widget_item& item = data_[ref];
|
||||
item["label"] = label;
|
||||
item["use_markup"] = utils::bool_string(markup);
|
||||
return *this;
|
||||
|
@ -173,7 +173,7 @@ public:
|
|||
private:
|
||||
tree_view_node& stuff_list_;
|
||||
const std::string defn_;
|
||||
std::map<std::string, string_map> data_;
|
||||
widget_data data_;
|
||||
};
|
||||
|
||||
class gamestate_inspector::view
|
||||
|
|
|
@ -89,8 +89,8 @@ void help_browser::add_topics_for_section(const help::section& parent_section, t
|
|||
tree_view_node& help_browser::add_topic(
|
||||
const std::string& topic_id, const std::string& topic_title, bool expands, tree_view_node& parent)
|
||||
{
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = topic_title;
|
||||
data.emplace("topic_name", item);
|
||||
|
@ -169,8 +169,8 @@ void help_browser::on_topic_select(window& window)
|
|||
return;
|
||||
}
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = format_help_text(topic->parsed_text());
|
||||
data.emplace("topic_text", item);
|
||||
|
|
|
@ -77,7 +77,7 @@ label_settings::label_settings(display_context& dc)
|
|||
team_name = _("Unknown");
|
||||
}
|
||||
|
||||
string_map subst;
|
||||
widget_item subst;
|
||||
subst["side_number"] = std::to_string(team.side());
|
||||
subst["name"] = team_name;
|
||||
|
||||
|
@ -87,7 +87,7 @@ label_settings::label_settings(display_context& dc)
|
|||
|
||||
void label_settings::pre_show(window& window)
|
||||
{
|
||||
std::map<std::string, string_map> list_data;
|
||||
widget_data list_data;
|
||||
listbox& cats_listbox = find_widget<listbox>(&window, "label_types", false);
|
||||
|
||||
for(const auto& label_entry : all_labels) {
|
||||
|
|
|
@ -64,7 +64,7 @@ void language_selection::pre_show(window& window)
|
|||
const language_def& current_language = get_language();
|
||||
for(const auto & lang : languages)
|
||||
{
|
||||
std::map<std::string, string_map> data;
|
||||
widget_data data;
|
||||
|
||||
data["language"]["label"] = lang.language;
|
||||
|
||||
|
|
|
@ -58,8 +58,8 @@ void log_settings::pre_show(window& window)
|
|||
|
||||
for(unsigned int i = 0; i < domain_list_.size(); i++){
|
||||
std::string this_domain = domain_list_[i];
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = this_domain;
|
||||
data["label"] = item;
|
||||
|
|
|
@ -92,8 +92,8 @@ void faction_select::pre_show(window& window)
|
|||
for(const config *s : flg_manager_.choosable_factions()) {
|
||||
const config& side = *s;
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
const std::string name = side["name"].str();
|
||||
// flag_rgb here is unrelated to any handling in the unit class
|
||||
|
|
|
@ -66,7 +66,7 @@ void sub_player_list::init(window& w, const std::string& lbl, const bool unfolde
|
|||
{
|
||||
tree_view& parent_tree = find_widget<tree_view>(&w, "player_tree", false);
|
||||
|
||||
std::map<std::string, string_map> tree_group_item;
|
||||
widget_data tree_group_item;
|
||||
tree_group_item["tree_view_node_label"]["label"] = lbl;
|
||||
|
||||
tree = &parent_tree.add_node("player_group", tree_group_item);
|
||||
|
@ -172,11 +172,11 @@ void mp_lobby::post_build(window& win)
|
|||
|
||||
namespace
|
||||
{
|
||||
void modify_grid_with_data(grid* grid, const std::map<std::string, string_map>& map)
|
||||
void modify_grid_with_data(grid* grid, const widget_data& map)
|
||||
{
|
||||
for(const auto& v : map) {
|
||||
const std::string& key = v.first;
|
||||
const string_map& strmap = v.second;
|
||||
const widget_item& strmap = v.second;
|
||||
|
||||
widget* w = grid->find(key, false);
|
||||
if(!w) {
|
||||
|
@ -396,10 +396,10 @@ void mp_lobby::update_gamelist_header()
|
|||
find_widget<label>(gamelistbox_, "map", false).set_label(games_string);
|
||||
}
|
||||
|
||||
std::map<std::string, string_map> mp_lobby::make_game_row_data(const mp::game_info& game)
|
||||
widget_data mp_lobby::make_game_row_data(const mp::game_info& game)
|
||||
{
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["use_markup"] = "true";
|
||||
|
||||
|
@ -648,8 +648,8 @@ void mp_lobby::update_playerlist()
|
|||
|
||||
assert(target_list->tree);
|
||||
|
||||
string_map tree_group_field;
|
||||
std::map<std::string, string_map> tree_group_item;
|
||||
widget_item tree_group_field;
|
||||
widget_data tree_group_item;
|
||||
|
||||
/*** Add tree item ***/
|
||||
tree_group_field["label"] = icon_ss.str();
|
||||
|
|
|
@ -77,7 +77,7 @@ protected:
|
|||
|
||||
void update_gamelist_filter();
|
||||
|
||||
std::map<std::string, string_map> make_game_row_data(const mp::game_info& game);
|
||||
widget_data make_game_row_data(const mp::game_info& game);
|
||||
|
||||
void adjust_game_row_contents(const mp::game_info& game, grid* grid, bool add_callbacks = true);
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ void mp_change_control::pre_show(window& window)
|
|||
|
||||
sides_.push_back(side);
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
std::string side_str = VGETTEXT("Side $side", {{"side", std::to_string(side)}});
|
||||
side_str = font::span_color(team::get_side_color(side)) + side_str + "</span>";
|
||||
|
@ -135,8 +135,8 @@ void mp_change_control::pre_show(window& window)
|
|||
for(const std::string& nick : temp_nicks) {
|
||||
nicks_.push_back(nick);
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["id"] = nick;
|
||||
item["label"] = nick;
|
||||
|
|
|
@ -93,8 +93,8 @@ void mp_server_list::pre_show(window& window)
|
|||
for(const auto & server : pref_servers)
|
||||
{
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = server.name;
|
||||
data.emplace("name", item);
|
||||
|
|
|
@ -206,8 +206,8 @@ void mp_create_game::pre_show(window& win)
|
|||
|
||||
const auto& activemods = preferences::modifications();
|
||||
for(const auto& mod : create_engine_.get_extras_by_type(ng::create_engine::MOD)) {
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = mod->name;
|
||||
data.emplace("mod_name", item);
|
||||
|
@ -608,8 +608,8 @@ void mp_create_game::display_games_of_type(window& window, ng::level::TYPE type,
|
|||
continue;
|
||||
}
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
if(type == ng::level::TYPE::CAMPAIGN || type == ng::level::TYPE::SP_CAMPAIGN) {
|
||||
item["label"] = game->icon();
|
||||
|
|
|
@ -341,7 +341,7 @@ void mp_join_game::generate_side_list(window& window)
|
|||
|
||||
tree.clear();
|
||||
team_tree_map_.clear();
|
||||
const std::map<std::string, string_map> empty_map;
|
||||
const widget_data empty_map;
|
||||
|
||||
int side_num = 0;
|
||||
for(const auto& side : get_scenario().child_range("side")) {
|
||||
|
@ -352,8 +352,8 @@ void mp_join_game::generate_side_list(window& window)
|
|||
|
||||
// Check to see whether we've added a toplevel tree node for this team. If not, add one
|
||||
if(team_tree_map_.find(side["team_name"].str()) == team_tree_map_.end()) {
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = (formatter() << _("Team:") << " " << t_string::from_serialized(side["user_team_name"])).str();
|
||||
data.emplace("tree_view_node_label", item);
|
||||
|
@ -364,8 +364,8 @@ void mp_join_game::generate_side_list(window& window)
|
|||
team_tree_map_[side["team_name"].str()] = &team_node;
|
||||
}
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
const std::string color = !side["color"].empty() ? side["color"] : side["side"].str();
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ std::pair<T*, config::attribute_value> mp_options_helper::add_node_and_get_widge
|
|||
void mp_options_helper::display_custom_options(const std::string& type, int node_position, const config& cfg)
|
||||
{
|
||||
// Needed since some compilers don't like passing just {}
|
||||
static const std::map<std::string, string_map> empty_map;
|
||||
static const widget_data empty_map;
|
||||
|
||||
// This ensures that any game, era, or mod with no options doesn't get an entry in the visible_options_
|
||||
// vector and prevents invalid options from different games, era, or mods being created when the options
|
||||
|
@ -216,8 +216,8 @@ void mp_options_helper::display_custom_options(const std::string& type, int node
|
|||
node_vector& type_node_vector = node_data_map_[type].nodes;
|
||||
|
||||
for(const auto& options : cfg.child_range("options")) {
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = cfg["name"];
|
||||
data.emplace("tree_view_node_label", item);
|
||||
|
|
|
@ -58,7 +58,7 @@ private:
|
|||
|
||||
int remove_nodes_for_type(const std::string& type);
|
||||
|
||||
using data_map = std::map<std::string, string_map>;
|
||||
using data_map = widget_data;
|
||||
|
||||
template <typename T>
|
||||
std::pair<T*, config::attribute_value> add_node_and_get_widget(
|
||||
|
|
|
@ -140,10 +140,10 @@ int mp_staging::get_side_node_position(ng::side_engine_ptr side) const
|
|||
void mp_staging::add_side_node(window& window, ng::side_engine_ptr side)
|
||||
{
|
||||
tree_view& tree = find_widget<tree_view>(&window, "side_list", false);
|
||||
static const std::map<std::string, string_map> empty_map;
|
||||
static const widget_data empty_map;
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = std::to_string(side->index() + 1);
|
||||
data.emplace("side_number", item);
|
||||
|
@ -157,8 +157,8 @@ void mp_staging::add_side_node(window& window, ng::side_engine_ptr side)
|
|||
|
||||
// Check to see whether we've added a toplevel tree node for this team. If not, add one
|
||||
if(team_tree_map_.find(side->team_name()) == team_tree_map_.end()) {
|
||||
std::map<std::string, string_map> tree_data;
|
||||
string_map tree_item;
|
||||
widget_data tree_data;
|
||||
widget_item tree_item;
|
||||
|
||||
tree_item["label"] = (formatter() << _("Team:") << " " << side->user_team_name()).str();
|
||||
tree_data.emplace("tree_view_node_label", tree_item);
|
||||
|
|
|
@ -24,7 +24,7 @@ player_list_helper::player_list_helper(window* window)
|
|||
: list_(find_widget<listbox>(window, "player_list", false))
|
||||
{
|
||||
// add ourselves as the host
|
||||
std::map<std::string, string_map> data = {
|
||||
widget_data data = {
|
||||
{ "player_type_icon", {{ "label", "misc/leader-crown.png~CROP(12, 1, 15, 15)"}}},
|
||||
{ "player_name", {{ "label", preferences::login()}}}
|
||||
};
|
||||
|
@ -38,8 +38,8 @@ void player_list_helper::update_list(const config::const_child_itors& users)
|
|||
unsigned i = 0;
|
||||
|
||||
for(const config& user : users) {
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
const std::string name = user["name"];
|
||||
const bool is_you = name == preferences::login();
|
||||
|
|
|
@ -171,10 +171,10 @@ void preferences_dialog::set_resolution_list(menu_button& res_list, CVideo& vide
|
|||
res_list.set_values(options, current_res);
|
||||
}
|
||||
|
||||
std::map<std::string, string_map> preferences_dialog::get_friends_list_row_data(const acquaintance& entry)
|
||||
widget_data preferences_dialog::get_friends_list_row_data(const acquaintance& entry)
|
||||
{
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
std::string image = "friend.png";
|
||||
std::string descriptor = _("friend");
|
||||
|
@ -585,7 +585,7 @@ void preferences_dialog::post_build(window& window)
|
|||
|
||||
listbox& advanced = find_widget<listbox>(&window, "advanced_prefs", false);
|
||||
|
||||
std::map<std::string, string_map> row_data;
|
||||
widget_data row_data;
|
||||
|
||||
for(const config& option : adv_preferences_cfg_) {
|
||||
// Details about the current option
|
||||
|
@ -781,7 +781,7 @@ listbox& preferences_dialog::setup_hotkey_list(window& window)
|
|||
{
|
||||
const std::string& default_icon = "misc/empty.png~CROP(0,0,15,15)";
|
||||
|
||||
std::map<std::string, string_map> row_data;
|
||||
widget_data row_data;
|
||||
|
||||
t_string& row_icon = row_data["img_icon"]["label"];
|
||||
t_string& row_action = row_data["lbl_desc"]["label"];
|
||||
|
|
|
@ -97,7 +97,7 @@ private:
|
|||
template<bool(*toggle_getter)(), bool(*toggle_setter)(bool), int(*vol_getter)(), void(*vol_setter)(int)>
|
||||
void initialize_sound_option_group(const std::string& id_suffix);
|
||||
|
||||
std::map<std::string, string_map> get_friends_list_row_data(const preferences::acquaintance& entry);
|
||||
widget_data get_friends_list_row_data(const preferences::acquaintance& entry);
|
||||
|
||||
void add_friend_list_entry(const bool is_friend, text_box& textbox, window& window);
|
||||
void remove_friend_list_entry(listbox& friends_list, text_box& textbox, window& window);
|
||||
|
|
|
@ -82,8 +82,8 @@ void simple_item_selector::pre_show(window& window)
|
|||
|
||||
for(const auto & it : items_)
|
||||
{
|
||||
std::map<std::string, string_map> data;
|
||||
string_map column;
|
||||
widget_data data;
|
||||
widget_item column;
|
||||
|
||||
column["label"] = it;
|
||||
data.emplace("item", column);
|
||||
|
|
|
@ -92,8 +92,8 @@ void statistics_dialog::add_stat_row(window& window, const std::string& type, co
|
|||
{
|
||||
listbox& stat_list = find_widget<listbox>(&window, "stats_list_main", false);
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = type;
|
||||
data.emplace("stat_type", item);
|
||||
|
@ -120,8 +120,8 @@ void statistics_dialog::add_damage_row(
|
|||
{
|
||||
listbox& damage_list = find_widget<listbox>(&window, "stats_list_damage", false);
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = type;
|
||||
data.emplace("damage_type", item);
|
||||
|
@ -239,8 +239,8 @@ void statistics_dialog::on_primary_list_select(window& window)
|
|||
continue;
|
||||
}
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = (formatter() << type->image() << "~RC(" << type->flag_rgb() << ">" << current_team_.color() << ")").str();
|
||||
data.emplace("unit_image", item);
|
||||
|
|
|
@ -73,8 +73,8 @@ void terrain_layers::pre_show(window& window)
|
|||
//const std::string& modif = img.get_modifications();
|
||||
const map_location& loc_cut = img.get_loc();
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = (formatter() << (ri->is_background() ? "B ": "F ") << order).str();
|
||||
data.emplace("index", item);
|
||||
|
|
|
@ -60,8 +60,8 @@ void theme_list::pre_show(window& window)
|
|||
|
||||
for(const auto & t : themes_)
|
||||
{
|
||||
std::map<std::string, string_map> data;
|
||||
string_map column;
|
||||
widget_data data;
|
||||
widget_item column;
|
||||
|
||||
std::string theme_name = t.name;
|
||||
if(theme_name.empty()) {
|
||||
|
|
|
@ -254,8 +254,8 @@ void title_screen::pre_show(window& win)
|
|||
}
|
||||
|
||||
for(const auto& tip : tips) {
|
||||
string_map widget;
|
||||
std::map<std::string, string_map> page;
|
||||
widget_item widget;
|
||||
widget_data page;
|
||||
|
||||
widget["use_markup"] = "true";
|
||||
|
||||
|
|
|
@ -54,8 +54,8 @@ void unit_advance::pre_show(window& window)
|
|||
for(std::size_t i = 0; i < previews_.size(); i++) {
|
||||
const unit& sample = *previews_[i];
|
||||
|
||||
std::map<std::string, string_map> row_data;
|
||||
string_map column;
|
||||
widget_data row_data;
|
||||
widget_item column;
|
||||
|
||||
std::string image_string, name = sample.type_name();
|
||||
|
||||
|
|
|
@ -162,8 +162,8 @@ void unit_attack::pre_show(window& window)
|
|||
<< defw_specials << "\n"
|
||||
<< font::span_color(d_cth_color) << defender.chance_to_hit << "%</span>";
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
item["use_markup"] = "true";
|
||||
|
||||
|
|
|
@ -115,8 +115,8 @@ void unit_create::pre_show(window& window)
|
|||
|
||||
units_.push_back(&i.second);
|
||||
|
||||
std::map<std::string, string_map> row_data;
|
||||
string_map column;
|
||||
widget_data row_data;
|
||||
widget_item column;
|
||||
|
||||
column["label"] = units_.back()->race()->plural_name();
|
||||
row_data.emplace("race", column);
|
||||
|
|
|
@ -94,8 +94,8 @@ void unit_list::pre_show(window& window)
|
|||
window.keyboard_capture(&list);
|
||||
|
||||
for(const unit_const_ptr& unit : unit_list_) {
|
||||
std::map<std::string, string_map> row_data;
|
||||
string_map column;
|
||||
widget_data row_data;
|
||||
widget_item column;
|
||||
|
||||
column["use_markup"] = "true";
|
||||
|
||||
|
|
|
@ -164,8 +164,8 @@ void unit_recall::pre_show(window& window)
|
|||
std::bind(&unit_recall::show_help, this));
|
||||
|
||||
for(const unit_const_ptr& unit : recall_list_) {
|
||||
std::map<std::string, string_map> row_data;
|
||||
string_map column;
|
||||
widget_data row_data;
|
||||
widget_item column;
|
||||
|
||||
std::string mods = unit->image_mods();
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ void unit_recruit::pre_show(window& window)
|
|||
|
||||
for(const auto& recruit : recruit_list_)
|
||||
{
|
||||
std::map<std::string, string_map> row_data;
|
||||
string_map column;
|
||||
widget_data row_data;
|
||||
widget_item column;
|
||||
|
||||
std::string image_string = recruit->image() + "~RC(" + recruit->flag_rgb() + ">"
|
||||
+ team_.color() + ")";
|
||||
|
|
|
@ -95,7 +95,7 @@ void wml_message_base::pre_show(window& window)
|
|||
listbox& options = find_widget<listbox>(&window, "input_list", true);
|
||||
|
||||
if(!option_list_.empty()) {
|
||||
std::map<std::string, string_map> data;
|
||||
widget_data data;
|
||||
for(const wml_message_option& item : option_list_) {
|
||||
// Add the data.
|
||||
data["icon"]["label"] = item.image();
|
||||
|
|
|
@ -156,8 +156,8 @@ void addon_list::set_addons(const addons_list& addons)
|
|||
|
||||
addon_vector_.push_back(&addon);
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
widget_data data;
|
||||
widget_item item;
|
||||
|
||||
if(!tracking_info.can_publish) {
|
||||
item["label"] = addon.display_icon();
|
||||
|
|
|
@ -413,10 +413,10 @@ lobby_chat_window* chatbox::find_or_create_window(const std::string& name,
|
|||
//
|
||||
// Add a new chat log page.
|
||||
//
|
||||
string_map item;
|
||||
widget_item item;
|
||||
item["use_markup"] = "true";
|
||||
item["label"] = initial_text;
|
||||
std::map<std::string, string_map> data{{"log_text", item}};
|
||||
widget_data data{{"log_text", item}};
|
||||
|
||||
if(!whisper) {
|
||||
lobby_info_->open_room(name);
|
||||
|
|
|
@ -1036,7 +1036,7 @@ void selection::select(grid& grid, const bool select)
|
|||
}
|
||||
|
||||
void selection::init(grid* g,
|
||||
const std::map<std::string /* widget id */, string_map>& data,
|
||||
const widget_data& data,
|
||||
const std::function<void(widget&)>& callback)
|
||||
{
|
||||
for(unsigned row = 0; row < g->get_rows(); ++row) {
|
||||
|
@ -1051,7 +1051,7 @@ void selection::init(grid* g,
|
|||
if(btn) {
|
||||
connect_signal_notify_modified(*btn, std::bind(callback, _1));
|
||||
|
||||
std::map<std::string, string_map>::const_iterator itor = data.find(btn->id());
|
||||
widget_data::const_iterator itor = data.find(btn->id());
|
||||
|
||||
if(itor == data.end()) {
|
||||
itor = data.find("");
|
||||
|
@ -1073,7 +1073,7 @@ void selection::init(grid* g,
|
|||
}
|
||||
|
||||
void show::init(grid* grid,
|
||||
const std::map<std::string /* widget id */, string_map>& data,
|
||||
const widget_data& data,
|
||||
const std::function<void(widget&)>& callback)
|
||||
{
|
||||
assert(!callback);
|
||||
|
|
|
@ -178,7 +178,7 @@ public:
|
|||
*/
|
||||
virtual grid& create_item(const int index,
|
||||
builder_grid_const_ptr list_builder,
|
||||
const string_map& item_data,
|
||||
const widget_item& item_data,
|
||||
const std::function<void(widget&)>& callback)
|
||||
= 0;
|
||||
|
||||
|
@ -202,7 +202,7 @@ public:
|
|||
virtual grid&
|
||||
create_item(const int index,
|
||||
builder_grid_const_ptr list_builder,
|
||||
const std::map<std::string /* widget id */, string_map>& data,
|
||||
const widget_data& data,
|
||||
const std::function<void(widget&)>& callback) = 0;
|
||||
|
||||
/**
|
||||
|
@ -222,7 +222,7 @@ public:
|
|||
*/
|
||||
virtual void create_items(const int index,
|
||||
builder_grid_const_ptr list_builder,
|
||||
const std::vector<string_map>& data,
|
||||
const std::vector<widget_item>& data,
|
||||
const std::function<void(widget&)>& callback)
|
||||
= 0;
|
||||
|
||||
|
@ -244,7 +244,7 @@ public:
|
|||
virtual void create_items(
|
||||
const int index,
|
||||
builder_grid_const_ptr list_builder,
|
||||
const std::vector<std::map<std::string /*widget id*/, string_map>>&
|
||||
const std::vector<std::map<std::string /*widget id*/, widget_item>>&
|
||||
data,
|
||||
const std::function<void(widget&)>& callback) = 0;
|
||||
|
||||
|
|
|
@ -510,7 +510,7 @@ struct selection : public virtual generator_base
|
|||
* in the grid is (de)selected.
|
||||
*/
|
||||
void init(grid* grid,
|
||||
const std::map<std::string /* widget id */, string_map>& data,
|
||||
const widget_data& data,
|
||||
const std::function<void(widget&)>& callback);
|
||||
};
|
||||
|
||||
|
@ -533,7 +533,7 @@ struct show : public virtual generator_base
|
|||
* should be nullptr.
|
||||
*/
|
||||
void init(grid* grid,
|
||||
const std::map<std::string /* widget id */, string_map>& data,
|
||||
const widget_data& data,
|
||||
const std::function<void(widget&)>& callback);
|
||||
};
|
||||
|
||||
|
@ -716,10 +716,10 @@ public:
|
|||
/** Inherited from generator_base. */
|
||||
grid& create_item(const int index,
|
||||
builder_grid_const_ptr list_builder,
|
||||
const string_map& item_data,
|
||||
const widget_item& item_data,
|
||||
const std::function<void(widget&)>& callback) override
|
||||
{
|
||||
std::map<std::string, string_map> data;
|
||||
widget_data data;
|
||||
|
||||
data.emplace("", item_data);
|
||||
return create_item(index, list_builder, data, callback);
|
||||
|
@ -728,7 +728,7 @@ public:
|
|||
/** Inherited from generator_base. */
|
||||
grid& create_item(const int index,
|
||||
builder_grid_const_ptr list_builder,
|
||||
const std::map<std::string /* widget id */, string_map>& item_data,
|
||||
const widget_data& item_data,
|
||||
const std::function<void(widget&)>& callback) override
|
||||
{
|
||||
assert(list_builder);
|
||||
|
@ -759,7 +759,7 @@ public:
|
|||
/** Inherited from generator_base. */
|
||||
virtual void create_items(const int index,
|
||||
builder_grid_const_ptr list_builder,
|
||||
const std::vector<std::map<std::string /*widget id*/, string_map>>& data,
|
||||
const std::vector<std::map<std::string /*widget id*/, widget_item>>& data,
|
||||
const std::function<void(widget&)>& callback) override
|
||||
{
|
||||
impl_create_items(index, list_builder, data, callback);
|
||||
|
@ -768,7 +768,7 @@ public:
|
|||
/** Inherited from generator_base. */
|
||||
virtual void create_items(const int index,
|
||||
builder_grid_const_ptr list_builder,
|
||||
const std::vector<string_map>& data,
|
||||
const std::vector<widget_item>& data,
|
||||
const std::function<void(widget&)>& callback) override
|
||||
{
|
||||
impl_create_items(index, list_builder, data, callback);
|
||||
|
@ -1090,7 +1090,7 @@ private:
|
|||
* in the grid is (de)selected.
|
||||
*/
|
||||
void init(grid* grid,
|
||||
const std::map<std::string /* widget id */, string_map>& data,
|
||||
const widget_data& data,
|
||||
const std::function<void(widget&)>& callback)
|
||||
{
|
||||
assert(grid);
|
||||
|
|
|
@ -62,7 +62,7 @@ listbox::listbox(const implementation::builder_styled_widget& builder,
|
|||
{
|
||||
}
|
||||
|
||||
grid& listbox::add_row(const string_map& item, const int index)
|
||||
grid& listbox::add_row(const widget_item& item, const int index)
|
||||
{
|
||||
assert(generator_);
|
||||
grid& row = generator_->create_item(index, list_builder_, item, std::bind(&listbox::list_item_clicked, this, _1));
|
||||
|
@ -72,7 +72,7 @@ grid& listbox::add_row(const string_map& item, const int index)
|
|||
return row;
|
||||
}
|
||||
|
||||
grid& listbox::add_row(const std::map<std::string /* widget id */, string_map>& data, const int index)
|
||||
grid& listbox::add_row(const widget_data& data, const int index)
|
||||
{
|
||||
assert(generator_);
|
||||
grid& row = generator_->create_item(index, list_builder_, data, std::bind(&listbox::list_item_clicked, this, _1));
|
||||
|
@ -523,7 +523,7 @@ void listbox::handle_key_right_arrow(SDL_Keymod modifier, bool& handled)
|
|||
|
||||
void listbox::finalize(builder_grid_const_ptr header,
|
||||
builder_grid_const_ptr footer,
|
||||
const std::vector<std::map<std::string, string_map>>& list_data)
|
||||
const std::vector<widget_data>& list_data)
|
||||
{
|
||||
// "Inherited."
|
||||
scrollbar_container::finalize_setup();
|
||||
|
@ -885,9 +885,9 @@ listbox_definition::resolution::resolution(const config& cfg)
|
|||
|
||||
namespace implementation
|
||||
{
|
||||
static std::vector<std::map<std::string, string_map>> parse_list_data(const config& data, const unsigned int req_cols)
|
||||
static std::vector<widget_data> parse_list_data(const config& data, const unsigned int req_cols)
|
||||
{
|
||||
std::vector<std::map<std::string, string_map>> list_data;
|
||||
std::vector<widget_data> list_data;
|
||||
|
||||
for(const auto& row : data.child_range("row")) {
|
||||
auto cols = row.child_range("column");
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
* @param index The item before which to add the new item,
|
||||
* 0 == begin, -1 == end.
|
||||
*/
|
||||
grid& add_row(const string_map& item, const int index = -1);
|
||||
grid& add_row(const widget_item& item, const int index = -1);
|
||||
|
||||
/**
|
||||
* Adds single row to the grid.
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
* @param index The item before which to add the new item,
|
||||
* 0 == begin, -1 == end.
|
||||
*/
|
||||
grid& add_row(const std::map<std::string /* widget id */, string_map>& data, const int index = -1);
|
||||
grid& add_row(const widget_data& data, const int index = -1);
|
||||
|
||||
/**
|
||||
* Removes a row in the listbox.
|
||||
|
@ -357,7 +357,7 @@ private:
|
|||
*/
|
||||
void finalize(builder_grid_const_ptr header,
|
||||
builder_grid_const_ptr footer,
|
||||
const std::vector<std::map<std::string, string_map>>& list_data);
|
||||
const std::vector<widget_data>& list_data);
|
||||
/**
|
||||
* Contains a pointer to the generator.
|
||||
*
|
||||
|
@ -465,7 +465,7 @@ struct builder_listbox : public builder_styled_widget
|
|||
* Contains a vector with the data to set in every cell, it's used to
|
||||
* serialize the data in the config, so the config is no longer required.
|
||||
*/
|
||||
std::vector<std::map<std::string, string_map>> list_data;
|
||||
std::vector<widget_data> list_data;
|
||||
|
||||
bool has_minimum_, has_maximum_;
|
||||
};
|
||||
|
@ -489,7 +489,7 @@ struct builder_horizontal_listbox : public builder_styled_widget
|
|||
* Contains a vector with the data to set in every cell, it's used to
|
||||
* serialize the data in the config, so the config is no longer required.
|
||||
*/
|
||||
std::vector<std::map<std::string, string_map>> list_data;
|
||||
std::vector<widget_data> list_data;
|
||||
|
||||
bool has_minimum_, has_maximum_;
|
||||
};
|
||||
|
@ -513,7 +513,7 @@ struct builder_grid_listbox : public builder_styled_widget
|
|||
* Contains a vector with the data to set in every cell, it's used to
|
||||
* serialize the data in the config, so the config is no longer required.
|
||||
*/
|
||||
std::vector<std::map<std::string, string_map>> list_data;
|
||||
std::vector<widget_data> list_data;
|
||||
|
||||
bool has_minimum_, has_maximum_;
|
||||
};
|
||||
|
|
|
@ -88,7 +88,7 @@ matrix::matrix(const implementation::builder_matrix& builder)
|
|||
}
|
||||
|
||||
unsigned
|
||||
matrix::create_item(const std::map<std::string, string_map>& item_data,
|
||||
matrix::create_item(const widget_data& item_data,
|
||||
const std::map<std::string, std::string>& tags)
|
||||
{
|
||||
return pane_->create_item(item_data, tags);
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
/***** ***** ***** ***** Item handling. ***** ***** ****** *****/
|
||||
|
||||
unsigned create_item(const std::map<std::string, string_map>& item_data,
|
||||
unsigned create_item(const widget_data& item_data,
|
||||
const std::map<std::string, std::string>& tags);
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ multi_page::multi_page(const implementation::builder_multi_page& builder)
|
|||
{
|
||||
}
|
||||
|
||||
grid& multi_page::add_page(const string_map& item)
|
||||
grid& multi_page::add_page(const widget_item& item)
|
||||
{
|
||||
assert(generator_);
|
||||
grid& page = generator_->create_item(-1, page_builders_.begin()->second, item, nullptr);
|
||||
|
@ -47,7 +47,7 @@ grid& multi_page::add_page(const string_map& item)
|
|||
return page;
|
||||
}
|
||||
|
||||
grid& multi_page::add_page(const std::string& type, int insert_pos, const string_map& item)
|
||||
grid& multi_page::add_page(const std::string& type, int insert_pos, const widget_item& item)
|
||||
{
|
||||
assert(generator_);
|
||||
auto it_builder = page_builders_.find(type);
|
||||
|
@ -56,7 +56,7 @@ grid& multi_page::add_page(const std::string& type, int insert_pos, const string
|
|||
}
|
||||
|
||||
grid& multi_page::add_page(
|
||||
const std::map<std::string /* widget id */, string_map>& data)
|
||||
const widget_data& data)
|
||||
{
|
||||
assert(generator_);
|
||||
grid& page = generator_->create_item(-1, page_builders_.begin()->second, data, nullptr);
|
||||
|
@ -65,7 +65,7 @@ grid& multi_page::add_page(
|
|||
}
|
||||
|
||||
grid& multi_page::add_page(
|
||||
const std::string& type, int insert_pos, const std::map<std::string /* widget id */, string_map>& data)
|
||||
const std::string& type, int insert_pos, const widget_data& data)
|
||||
{
|
||||
assert(generator_);
|
||||
auto it_builder = page_builders_.find(type);
|
||||
|
@ -136,7 +136,7 @@ unsigned multi_page::get_state() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
void multi_page::finalize(const std::vector<string_map>& page_data)
|
||||
void multi_page::finalize(const std::vector<widget_item>& page_data)
|
||||
{
|
||||
assert(generator_);
|
||||
generator_->create_items(-1, page_builders_.begin()->second, page_data, nullptr);
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
*
|
||||
* @returns The grid of the newly added page.
|
||||
*/
|
||||
grid& add_page(const string_map& item);
|
||||
grid& add_page(const widget_item& item);
|
||||
/**
|
||||
* Adds single page to the grid.
|
||||
*
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
*
|
||||
* @returns The grid of the newly added page.
|
||||
*/
|
||||
grid& add_page(const std::string& type, int insert_pos, const string_map& item);
|
||||
grid& add_page(const std::string& type, int insert_pos, const widget_item& item);
|
||||
|
||||
/**
|
||||
* Adds single page to the grid.
|
||||
|
@ -87,7 +87,7 @@ public:
|
|||
*
|
||||
* @returns The grid of the newly added page.
|
||||
*/
|
||||
grid& add_page(const std::map<std::string /* widget id */, string_map>& data);
|
||||
grid& add_page(const widget_data& data);
|
||||
/**
|
||||
* Adds single page to the grid.
|
||||
*
|
||||
|
@ -110,7 +110,7 @@ public:
|
|||
*
|
||||
* @returns The grid of the newly added page.
|
||||
*/
|
||||
grid& add_page(const std::string& type, int insert_pos, const std::map<std::string /* widget id */, string_map>& data);
|
||||
grid& add_page(const std::string& type, int insert_pos, const widget_data& data);
|
||||
|
||||
/**
|
||||
* Removes a page in the multi page.
|
||||
|
@ -186,7 +186,7 @@ private:
|
|||
*
|
||||
* @param page_data The initial data to fill the widget with.
|
||||
*/
|
||||
void finalize(const std::vector<string_map>& page_data);
|
||||
void finalize(const std::vector<widget_item>& page_data);
|
||||
|
||||
/**
|
||||
* Contains a pointer to the generator.
|
||||
|
|
|
@ -118,7 +118,7 @@ pane::pane(const implementation::builder_pane& builder)
|
|||
event::dispatcher::back_pre_child);
|
||||
}
|
||||
|
||||
unsigned pane::create_item(const std::map<std::string, string_map>& item_data,
|
||||
unsigned pane::create_item(const widget_data& item_data,
|
||||
const std::map<std::string, std::string>& tags)
|
||||
{
|
||||
item item { item_id_generator_++, tags, std::dynamic_pointer_cast<grid>(item_builder_->build()) };
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
/*
|
||||
* Creates a new item.
|
||||
*/
|
||||
unsigned create_item(const std::map<std::string, string_map>& item_data,
|
||||
unsigned create_item(const widget_data& item_data,
|
||||
const std::map<std::string, std::string>& tags);
|
||||
|
||||
/** See @ref widget::place. */
|
||||
|
|
|
@ -85,7 +85,7 @@ void
|
|||
stacked_widget::finalize(std::vector<builder_grid_const_ptr> widget_builder)
|
||||
{
|
||||
assert(generator_);
|
||||
string_map empty_data;
|
||||
widget_item empty_data;
|
||||
for(const auto & builder : widget_builder)
|
||||
{
|
||||
generator_->create_item(-1, builder, empty_data, nullptr);
|
||||
|
|
|
@ -87,11 +87,11 @@ styled_widget::styled_widget(const implementation::builder_styled_widget& builde
|
|||
&styled_widget::signal_handler_notify_remove_tooltip, this, _2, _3));
|
||||
}
|
||||
|
||||
void styled_widget::set_members(const string_map& data)
|
||||
void styled_widget::set_members(const widget_item& data)
|
||||
{
|
||||
/** @todo document this feature on the wiki. */
|
||||
/** @todo do we need to add the debug colors here as well? */
|
||||
string_map::const_iterator itor = data.find("id");
|
||||
widget_item::const_iterator itor = data.find("id");
|
||||
if(itor != data.end()) {
|
||||
set_id(itor->second);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
* @param data Map with the key value pairs to set the
|
||||
* members.
|
||||
*/
|
||||
virtual void set_members(const string_map& data);
|
||||
virtual void set_members(const widget_item& data);
|
||||
|
||||
/***** ***** ***** ***** State handling ***** ***** ***** *****/
|
||||
|
||||
|
|
|
@ -64,12 +64,12 @@ unsigned toggle_button::num_states() const
|
|||
return res.quot;
|
||||
}
|
||||
|
||||
void toggle_button::set_members(const string_map& data)
|
||||
void toggle_button::set_members(const widget_item& data)
|
||||
{
|
||||
// Inherit
|
||||
styled_widget::set_members(data);
|
||||
|
||||
string_map::const_iterator itor = data.find("icon");
|
||||
widget_item::const_iterator itor = data.find("icon");
|
||||
if(itor != data.end()) {
|
||||
set_icon_name(itor->second);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
|
||||
|
||||
/** See @ref styled_widget::set_members. */
|
||||
void set_members(const string_map& data) override;
|
||||
void set_members(const widget_item& data) override;
|
||||
|
||||
/** See @ref styled_widget::set_active. */
|
||||
virtual void set_active(const bool active) override;
|
||||
|
|
|
@ -86,7 +86,7 @@ unsigned toggle_panel::num_states() const
|
|||
}
|
||||
|
||||
void toggle_panel::set_child_members(
|
||||
const std::map<std::string /* widget id */, string_map>& data)
|
||||
const widget_data& data)
|
||||
{
|
||||
for(const auto & item : data)
|
||||
{
|
||||
|
|
|
@ -49,8 +49,7 @@ public:
|
|||
* @param data Map with the key value pairs to set the
|
||||
* members.
|
||||
*/
|
||||
void set_child_members(
|
||||
const std::map<std::string /* widget id */, string_map>& data);
|
||||
void set_child_members(const widget_data& data);
|
||||
|
||||
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ tree_view::tree_view(const implementation::builder_tree_view& builder)
|
|||
, node_definitions_(builder.nodes)
|
||||
, indentation_step_size_(0)
|
||||
, need_layout_(false)
|
||||
, root_node_(new tree_view_node("root", nullptr, *this, std::map<std::string, string_map>()))
|
||||
, root_node_(new tree_view_node("root", nullptr, *this, widget_data()))
|
||||
, selected_item_(nullptr)
|
||||
{
|
||||
connect_signal<event::LEFT_BUTTON_DOWN>(
|
||||
|
@ -53,7 +53,7 @@ tree_view::~tree_view()
|
|||
}
|
||||
|
||||
tree_view_node& tree_view::add_node(
|
||||
const std::string& id, const std::map<std::string /* widget id */, string_map>& data, const int index)
|
||||
const std::string& id, const widget_data& data, const int index)
|
||||
{
|
||||
return get_root_node().add_child(id, data, index);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
|
||||
tree_view_node&
|
||||
add_node(const std::string& id,
|
||||
const std::map<std::string /* widget id */, string_map>& data,
|
||||
const widget_data& data,
|
||||
const int index = -1);
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace gui2
|
|||
tree_view_node::tree_view_node(const std::string& id,
|
||||
tree_view_node* parent_node,
|
||||
tree_view& parent_tree_view,
|
||||
const std::map<std::string /* widget id */, string_map>& data)
|
||||
const widget_data& data)
|
||||
: widget()
|
||||
, parent_node_(parent_node)
|
||||
, tree_view_(&parent_tree_view)
|
||||
|
@ -604,7 +604,7 @@ void tree_view_node::signal_handler_label_left_button_click(const event::ui_even
|
|||
fire(event::NOTIFY_MODIFIED, get_tree_view(), nullptr);
|
||||
}
|
||||
|
||||
void tree_view_node::init_grid(grid* g, const std::map<std::string /* widget id */, string_map>& data)
|
||||
void tree_view_node::init_grid(grid* g, const widget_data& data)
|
||||
{
|
||||
assert(g);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
const std::string& id,
|
||||
tree_view_node* parent_node,
|
||||
tree_view& parent_tree_view,
|
||||
const std::map<std::string /* widget id */, string_map>& data);
|
||||
const widget_data& data);
|
||||
|
||||
~tree_view_node();
|
||||
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
* 0 == begin, -1 == end.
|
||||
*/
|
||||
tree_view_node& add_child(const std::string& id,
|
||||
const std::map<std::string /* widget id */, string_map>& data,
|
||||
const widget_data& data,
|
||||
const int index = -1)
|
||||
{
|
||||
return add_child_impl(std::make_shared<tree_view_node>(id, this, get_tree_view(), data), index);
|
||||
|
@ -99,9 +99,7 @@ public:
|
|||
* Having both empty and non-empty id's gives
|
||||
* undefined behavior.
|
||||
*/
|
||||
tree_view_node&
|
||||
add_sibling(const std::string& id,
|
||||
const std::map<std::string /* widget id */, string_map>& data)
|
||||
tree_view_node& add_sibling(const std::string& id, const widget_data& data)
|
||||
{
|
||||
assert(!is_root_node());
|
||||
return parent_node().add_child(id, data);
|
||||
|
@ -305,9 +303,7 @@ private:
|
|||
bool& handled,
|
||||
bool& halt);
|
||||
|
||||
void
|
||||
init_grid(grid* grid,
|
||||
const std::map<std::string /* widget id */, string_map>& data);
|
||||
void init_grid(grid* grid, const widget_data& data);
|
||||
|
||||
/**
|
||||
* Returns the control_type of the @ref tree_view_node.
|
||||
|
|
|
@ -14,19 +14,20 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "gui/core/event/dispatcher.hpp"
|
||||
#include "sdl/point.hpp"
|
||||
#include "gui/widgets/event_executor.hpp"
|
||||
#include "color.hpp"
|
||||
#include "gui/core/event/dispatcher.hpp"
|
||||
#include "gui/widgets/event_executor.hpp"
|
||||
#include "sdl/point.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
class surface;
|
||||
|
||||
typedef std::map<std::string, t_string> string_map;
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
/* Data format used by styled_widget::set_members to set settings for a single widget. */
|
||||
using widget_item = std::map<std::string, t_string>;
|
||||
|
||||
/* Indexes multiple @ref widget_item maps by widget ID. */
|
||||
using widget_data = std::map<std::string, widget_item>;
|
||||
|
||||
struct builder_widget;
|
||||
class window;
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <vector>
|
||||
|
||||
class CVideo;
|
||||
class surface;
|
||||
struct point;
|
||||
|
||||
namespace gui2
|
||||
|
|
|
@ -909,7 +909,7 @@ int intf_add_dialog_tree_node(lua_State* L)
|
|||
{
|
||||
const std::string node_type = luaL_checkstring(L, 1);
|
||||
const int insert_pos = luaL_checkinteger(L, 2);
|
||||
static const std::map<std::string, string_map> data;
|
||||
static const gui2::widget_data data;
|
||||
gui2::widget* w = find_widget(L, 3, false);
|
||||
|
||||
if(gui2::tree_view_node* twn = dynamic_cast<gui2::tree_view_node*>(w)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue