Added GUI2 Unit List dialog (unused yet)
This commit is contained in:
parent
40bc508f7f
commit
9c683576d9
7 changed files with 716 additions and 1 deletions
411
data/gui/window/unit_list.cfg
Normal file
411
data/gui/window/unit_list.cfg
Normal file
|
@ -0,0 +1,411 @@
|
|||
#textdomain wesnoth-lib
|
||||
###
|
||||
### Definition of the window to create units in debug mode.
|
||||
###
|
||||
|
||||
#define _GUI_UNIT_LIST
|
||||
[listbox]
|
||||
id = "units_list"
|
||||
definition = "default"
|
||||
|
||||
[header]
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_0"
|
||||
definition = "listbox_header"
|
||||
linked_group = "type"
|
||||
|
||||
label = _ "Type"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_1"
|
||||
definition = "listbox_header"
|
||||
linked_group = "name"
|
||||
|
||||
label = _ "Name"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_2"
|
||||
definition = "listbox_header"
|
||||
linked_group = "moves"
|
||||
|
||||
label = _ "Moves"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "left,right"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "sort_3"
|
||||
definition = "gold_small"
|
||||
linked_group = "status"
|
||||
|
||||
label = _ "Status"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
definition = "listbox_header"
|
||||
linked_group = "hp"
|
||||
|
||||
label = _ "HP"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_4"
|
||||
definition = "listbox_header"
|
||||
linked_group = "level"
|
||||
|
||||
label = _ "Lvl"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_5"
|
||||
definition = "listbox_header"
|
||||
linked_group = "experience"
|
||||
|
||||
label = _ "XP"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
# No border by design
|
||||
[toggle_button]
|
||||
id = "sort_6"
|
||||
definition = "listbox_header"
|
||||
linked_group = "traits"
|
||||
|
||||
label = _ "Traits"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
[/row]
|
||||
[/header]
|
||||
|
||||
[list_definition]
|
||||
[row]
|
||||
[column]
|
||||
vertical_grow = "true"
|
||||
horizontal_grow = "true"
|
||||
|
||||
[toggle_panel]
|
||||
definition = "default"
|
||||
return_value_id = "ok"
|
||||
|
||||
[grid]
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = "left,top,right"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "unit_type"
|
||||
definition = "default"
|
||||
linked_group = "type"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "unit_name"
|
||||
definition = "default"
|
||||
linked_group = "name"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "unit_moves"
|
||||
definition = "default"
|
||||
linked_group = "moves"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[image]
|
||||
id = "unit_status"
|
||||
definition = "default"
|
||||
linked_group = "status"
|
||||
[/image]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "unit_hp"
|
||||
definition = "default"
|
||||
linked_group = "hp"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "unit_level"
|
||||
definition = "default"
|
||||
linked_group = "level"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "unit_experience"
|
||||
definition = "default_small"
|
||||
linked_group = "experience"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "unit_traits"
|
||||
definition = "default_small"
|
||||
linked_group = "traits"
|
||||
[/label]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/toggle_panel]
|
||||
[/column]
|
||||
[/row]
|
||||
[/list_definition]
|
||||
[/listbox]
|
||||
#enddef
|
||||
|
||||
[window]
|
||||
id = "unit_list"
|
||||
description = "Unit recall dialog."
|
||||
|
||||
[resolution]
|
||||
definition = "default"
|
||||
automatic_placement = "true"
|
||||
vertical_placement = "center"
|
||||
horizontal_placement = "center"
|
||||
|
||||
maximum_height = 700
|
||||
|
||||
[linked_group]
|
||||
id = "type"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "name"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "moves"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "status"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "hp"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "level"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "experience"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "traits"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[tooltip]
|
||||
id = "tooltip"
|
||||
[/tooltip]
|
||||
|
||||
[helptip]
|
||||
id = "tooltip"
|
||||
[/helptip]
|
||||
|
||||
[grid]
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[label]
|
||||
definition = "title"
|
||||
label = _ "Unit List"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
horizontal_grow = "true"
|
||||
vertical_grow = "true"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
vertical_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[unit_preview_pane]
|
||||
definition = "default"
|
||||
id = "unit_details"
|
||||
[/unit_preview_pane]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_grow = "true"
|
||||
vertical_grow = "true"
|
||||
|
||||
{_GUI_UNIT_LIST}
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
horizontal_alignment = "right"
|
||||
|
||||
[grid]
|
||||
[row]
|
||||
grow_factor=0
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "right"
|
||||
[button]
|
||||
id = "ok"
|
||||
definition = "default"
|
||||
label = _ "Scroll To"
|
||||
[/button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "right"
|
||||
[button]
|
||||
id = "cancel"
|
||||
definition = "default"
|
||||
label = _ "Close"
|
||||
[/button]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/resolution]
|
||||
|
||||
[/window]
|
||||
|
||||
#undef _GUI_UNIT_LIST
|
|
@ -627,6 +627,8 @@
|
|||
<Unit filename="../../src/gui/dialogs/unit_attack.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/unit_create.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/unit_create.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/unit_list.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/unit_list.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/unit_recall.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/unit_recall.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/unit_recruit.cpp" />
|
||||
|
|
|
@ -843,6 +843,7 @@ set(wesnoth-main_SRC
|
|||
gui/dialogs/transient_message.cpp
|
||||
gui/dialogs/unit_attack.cpp
|
||||
gui/dialogs/unit_create.cpp
|
||||
gui/dialogs/unit_list.cpp
|
||||
gui/dialogs/unit_recall.cpp
|
||||
gui/dialogs/unit_recruit.cpp
|
||||
gui/dialogs/wml_error.cpp
|
||||
|
|
|
@ -420,7 +420,8 @@ wesnoth_sources = Split("""
|
|||
gui/dialogs/transient_message.cpp
|
||||
gui/dialogs/unit_attack.cpp
|
||||
gui/dialogs/unit_create.cpp
|
||||
gui/dialogs/unit_recall.cpp
|
||||
gui/dialogs/unit_list.cpp
|
||||
gui/dialogs/unit_recall.cpp
|
||||
gui/dialogs/unit_recruit.cpp
|
||||
gui/dialogs/wml_error.cpp
|
||||
gui/dialogs/wml_message.cpp
|
||||
|
|
230
src/gui/dialogs/unit_list.cpp
Normal file
230
src/gui/dialogs/unit_list.cpp
Normal file
|
@ -0,0 +1,230 @@
|
|||
/*
|
||||
Copyright (C) 2016 by the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#define GETTEXT_DOMAIN "wesnoth-lib"
|
||||
|
||||
#include "gui/dialogs/unit_list.hpp"
|
||||
|
||||
#include "gui/auxiliary/find_widget.hpp"
|
||||
#include "gui/core/log.hpp"
|
||||
#include "gui/dialogs/helper.hpp"
|
||||
#include "gui/dialogs/message.hpp"
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
#include "gui/widgets/list.hpp"
|
||||
#else
|
||||
#include "gui/widgets/listbox.hpp"
|
||||
#endif
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "gui/widgets/button.hpp"
|
||||
#include "gui/widgets/image.hpp"
|
||||
#include "gui/widgets/label.hpp"
|
||||
#include "gui/widgets/toggle_button.hpp"
|
||||
#include "gui/widgets/unit_preview_pane.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "display.hpp"
|
||||
#include "formatter.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "marked-up_text.hpp"
|
||||
#include "units/map.hpp"
|
||||
#include "units/ptr.hpp"
|
||||
#include "units/unit.hpp"
|
||||
|
||||
#include "utils/functional.hpp"
|
||||
|
||||
static lg::log_domain log_display("display");
|
||||
#define LOG_DP LOG_STREAM(info, log_display)
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
||||
REGISTER_DIALOG(unit_list)
|
||||
|
||||
tunit_list::tunit_list(const display& gui)
|
||||
: unit_list_{std::make_shared<std::vector<unit_const_ptr> >()}
|
||||
{
|
||||
const unit_map& units = gui.get_units();
|
||||
for(unit_map::const_iterator i = units.begin(); i != units.end(); ++i) {
|
||||
if(i->side() != gui.viewing_side()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
unit_list_->push_back(i.get_shared_ptr());
|
||||
}
|
||||
|
||||
//for(const unit_map& u : gui.get_units()) {
|
||||
// unit_list_->push_back(u.get_shared_ptr());
|
||||
//}
|
||||
}
|
||||
|
||||
static std::string format_level_string(const int level)
|
||||
{
|
||||
std::string lvl = std::to_string(level);
|
||||
|
||||
if(level < 1) {
|
||||
return "<span color='#969696'>" + lvl + "</span>";
|
||||
} else if(level == 1) {
|
||||
return lvl;
|
||||
} else if(level == 2) {
|
||||
return "<b>" + lvl + "</b>";
|
||||
} else if(level > 2 ) {
|
||||
return"<b><span color='#ffffff'>" + lvl + "</span></b>";
|
||||
}
|
||||
|
||||
return lvl;
|
||||
}
|
||||
|
||||
static std::string format_if_leader(unit_const_ptr u, const std::string str)
|
||||
{
|
||||
return (*u).can_recruit() ? "<span color='#cdad00'>" + str + "</span>" : str;
|
||||
}
|
||||
|
||||
static std::string format_movement_string(unit_const_ptr u)
|
||||
{
|
||||
const int moves_left = (*u).movement_left();
|
||||
const int moves_max = (*u).total_movement();
|
||||
|
||||
std::string color = "#00ff00";
|
||||
|
||||
if(moves_left == 0) {
|
||||
color = "#ff0000";
|
||||
} else if(moves_left < moves_max) {
|
||||
color = "#ffff00";
|
||||
}
|
||||
|
||||
return formatter() << "<span color='" << color << "'>" << moves_left << "/" << moves_max << "</span>";
|
||||
}
|
||||
|
||||
template<typename Fcn>
|
||||
void tunit_list::init_sorting_option(generator_sort_array& order_funcs, Fcn filter_on)
|
||||
{
|
||||
order_funcs[0] = [this, filter_on](unsigned i1, unsigned i2) {
|
||||
return filter_on((*unit_list_)[i1]) < filter_on((*unit_list_)[i2]);
|
||||
};
|
||||
|
||||
order_funcs[1] = [this, filter_on](unsigned i1, unsigned i2) {
|
||||
return filter_on((*unit_list_)[i1]) > filter_on((*unit_list_)[i2]);
|
||||
};
|
||||
}
|
||||
|
||||
void tunit_list::pre_show(twindow& window)
|
||||
{
|
||||
tlistbox& list = find_widget<tlistbox>(&window, "units_list", false);
|
||||
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
connect_signal_notify_modified(*list,
|
||||
std::bind(&tunit_list::list_item_clicked,
|
||||
*this, std::ref(window)));
|
||||
#else
|
||||
list.set_callback_value_change(
|
||||
dialog_callback<tunit_list, &tunit_list::list_item_clicked>);
|
||||
#endif
|
||||
|
||||
list.clear();
|
||||
|
||||
window.keyboard_capture(&list);
|
||||
|
||||
if(!unit_list_) return;
|
||||
|
||||
for(const unit_const_ptr& unit : *unit_list_) {
|
||||
std::map<std::string, string_map> row_data;
|
||||
string_map column;
|
||||
|
||||
std::string mods = unit->image_mods();
|
||||
|
||||
if(unit->can_recruit()) {
|
||||
mods += "~BLIT(" + unit::leader_crown() + ")";
|
||||
}
|
||||
|
||||
for(const std::string& overlay : unit->overlays()) {
|
||||
mods += "~BLIT(" + overlay + ")";
|
||||
}
|
||||
|
||||
column["use_markup"] = "true";
|
||||
|
||||
column["label"] = format_if_leader(unit, unit->type_name());
|
||||
row_data.insert(std::make_pair("unit_type", column));
|
||||
|
||||
const std::string& name = !unit->name().empty() ? format_if_leader(unit, unit->name().str()) : utils::unicode_en_dash;
|
||||
column["label"] = name;
|
||||
row_data.insert(std::make_pair("unit_name", column));
|
||||
|
||||
column["label"] = format_movement_string(unit);
|
||||
row_data.insert(std::make_pair("unit_moves", column));
|
||||
|
||||
std::stringstream hp_str;
|
||||
hp_str << font::span_color(unit->hp_color()) << unit->hitpoints() << "/" << unit->max_hitpoints() << "</span>";
|
||||
|
||||
column["label"] = hp_str.str();
|
||||
row_data.insert(std::make_pair("unit_hp", column));
|
||||
|
||||
column["label"] = format_level_string(unit->level());
|
||||
row_data.insert(std::make_pair("unit_level", column));
|
||||
|
||||
std::stringstream exp_str;
|
||||
exp_str << font::span_color(unit->xp_color()) << unit->experience() << "/"
|
||||
<< (unit->can_advance() ? std::to_string(unit->max_experience()) : utils::unicode_en_dash) << "</span>";
|
||||
|
||||
column["label"] = exp_str.str();
|
||||
row_data.insert(std::make_pair("unit_experience", column));
|
||||
|
||||
column["label"] = utils::join(unit->trait_names(), ", ");
|
||||
row_data.insert(std::make_pair("unit_traits", column));
|
||||
|
||||
list.add_row(row_data);
|
||||
}
|
||||
|
||||
generator_sort_array order_funcs;
|
||||
|
||||
init_sorting_option(order_funcs, [](unit_const_ptr u) { return u.get()->type_name().str(); });
|
||||
list.set_column_order(0, order_funcs);
|
||||
|
||||
init_sorting_option(order_funcs, [](unit_const_ptr u) { return u.get()->name().str(); });
|
||||
list.set_column_order(1, order_funcs);
|
||||
|
||||
init_sorting_option(order_funcs, [](unit_const_ptr u) { return u.get()->level(); });
|
||||
list.set_column_order(2, order_funcs);
|
||||
|
||||
init_sorting_option(order_funcs, [](unit_const_ptr u) { return u.get()->experience(); });
|
||||
list.set_column_order(3, order_funcs);
|
||||
|
||||
init_sorting_option(order_funcs, [](unit_const_ptr u) {
|
||||
return !u.get()->trait_names().empty() ? u.get()->trait_names().front().str() : "";
|
||||
});
|
||||
|
||||
list.set_column_order(4, order_funcs);
|
||||
|
||||
list_item_clicked(window);
|
||||
}
|
||||
|
||||
void tunit_list::list_item_clicked(twindow& window)
|
||||
{
|
||||
const int selected_row
|
||||
= find_widget<tlistbox>(&window, "units_list", false).get_selected_row();
|
||||
|
||||
if(selected_row == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
find_widget<tunit_preview_pane>(&window, "unit_details", false)
|
||||
.set_displayed_unit(unit_list_->at(selected_row).get());
|
||||
}
|
||||
|
||||
void tunit_list::post_show(twindow& window)
|
||||
{
|
||||
//if(get_retval() == twindow::OK) {
|
||||
// selected_index_ = find_widget<tlistbox>(&window, "units_list", false)
|
||||
// .get_selected_row();
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
67
src/gui/dialogs/unit_list.hpp
Normal file
67
src/gui/dialogs/unit_list.hpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
Copyright (C) 2016 by the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#ifndef GUI_DIALOGS_UNIT_LIST_HPP_INCLUDED
|
||||
#define GUI_DIALOGS_UNIT_LIST_HPP_INCLUDED
|
||||
|
||||
#include "gui/dialogs/dialog.hpp"
|
||||
#include "gui/widgets/generator.hpp"
|
||||
#include "units/ptr.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class display;
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
||||
class ttext_;
|
||||
|
||||
class tunit_list : public tdialog
|
||||
{
|
||||
typedef std::shared_ptr<std::vector<unit_const_ptr> > unit_ptr_vector;
|
||||
|
||||
public:
|
||||
explicit tunit_list(const display& gui);
|
||||
|
||||
int get_selected_index() const
|
||||
{
|
||||
return selected_index_;
|
||||
}
|
||||
|
||||
private:
|
||||
unit_ptr_vector unit_list_;
|
||||
|
||||
int selected_index_;
|
||||
|
||||
template<typename Fcn>
|
||||
void init_sorting_option(generator_sort_array& order_funcs, Fcn filter_on);
|
||||
|
||||
/** Callbacks */
|
||||
void list_item_clicked(twindow& window);
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
void pre_show(twindow& window);
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
void post_show(twindow& window);
|
||||
};
|
||||
|
||||
} // namespace gui2
|
||||
|
||||
#endif /* ! GUI_DIALOGS_UNIT_LIST_HPP_INCLUDED */
|
|
@ -76,6 +76,7 @@
|
|||
#include "gui/dialogs/transient_message.hpp"
|
||||
#include "gui/dialogs/unit_attack.hpp"
|
||||
#include "gui/dialogs/unit_create.hpp"
|
||||
#include "gui/dialogs/unit_list.hpp"
|
||||
#include "gui/dialogs/unit_recall.hpp"
|
||||
#include "gui/dialogs/unit_recruit.hpp"
|
||||
#include "gui/dialogs/wml_error.hpp"
|
||||
|
@ -410,6 +411,7 @@ BOOST_AUTO_TEST_CASE(test_gui2)
|
|||
test<gui2::ttransient_message>();
|
||||
//test<gui2::tunit_attack>();
|
||||
test<gui2::tunit_create>();
|
||||
//test<gui2::tunit_list>();
|
||||
//test<gui2::tunit_recall>();
|
||||
//test<gui2::tunit_recruit>();
|
||||
test<gui2::twml_error>();
|
||||
|
@ -473,6 +475,7 @@ BOOST_AUTO_TEST_CASE(test_gui2)
|
|||
list.erase(std::remove(list.begin(), list.end(), "preferences"), list.end());
|
||||
list.erase(std::remove(list.begin(), list.end(), "unit_recruit"), list.end());
|
||||
list.erase(std::remove(list.begin(), list.end(), "unit_recall"), list.end());
|
||||
list.erase(std::remove(list.begin(), list.end(), "unit_list"), list.end());
|
||||
|
||||
// Test size() instead of empty() to get the number of offenders
|
||||
BOOST_CHECK_EQUAL(list.size(), 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue