27 #include <boost/dynamic_bitset/dynamic_bitset.hpp>
96 find_widget<toggle_button>(
id).
set_visible(visible);
128 template<
typename Value,
typename Generator = std::function<std::
string(const Value&)>>
131 const std::vector<Value>& container,
133 const bool use_as_sorter =
false)
138 find_widget<gui2::listbox>(
"main_list").set_single_sorter(
144 template<
typename Value,
typename Generator = std::function<std::
string(const Value&)>
145 ,
typename Sorter = std::function<std::
string(const Value&)>>
148 const std::vector<Value>& container,
150 const Sorter& sorter)
153 find_widget<gui2::listbox>(
"main_list").set_single_sorter(
154 id, [&container, sorter](std::size_t
index) {
return sorter(container[
index]); });
161 template<
typename Value,
typename Generator = std::function<std::
string(const Value&)>>
163 const std::vector<Value>& container,
const Generator&
generator)
171 static std::unique_ptr<units_dialog>
build_create_dialog(
const std::vector<const unit_type*>& types_list);
209 void rename_unit(std::vector<unit_const_ptr>& unit_list);
Abstract base class for all modal dialogs.
bool show(const unsigned auto_close_time=0)
Shows the window.
void filter_text_changed()
void show_list(listbox &list)
static std::unique_ptr< units_dialog > build_recruit_dialog(const std::vector< const unit_type * > &recruit_list, const team &team)
std::vector< std::string > filter_options_
units_dialog & set_ok_label(const std::string &ok_label)
units_dialog & show_all_headers(const bool show=true)
std::function< std::string(std::size_t)> tooltip_gen_
std::function< void(const std::size_t)> update_view_
virtual void post_show() override
Actions to be taken after the window has been shown.
void rename_unit(std::vector< unit_const_ptr > &unit_list)
std::string variation() const
Variation choice from the user.
units_dialog & show_header(std::string_view id, const bool visible=true)
units_dialog & set_help_topic(const std::string &topic_id)
units_dialog & set_update_function(const std::function< void(const std::size_t)> &update_func)
Called to update the UI components, such as the preview pane, gender toggles and variation box.
std::vector< std::string > last_words_
units_dialog & set_column(std::string_view id, const std::vector< Value > &container, const Generator &generator, const Sorter &sorter)
units_dialog & set_cancel_label(const std::string &cancel_label)
units_dialog & set_tooltip_generator(const std::vector< Value > &container, const Generator &generator)
Sets the generator function for the tooltips.
group< unit_race::GENDER > & get_toggle()
std::vector< unit_const_ptr > unit_list_
group< unit_race::GENDER > gender_toggle_
unit_race::GENDER gender_
static std::unique_ptr< units_dialog > build_unit_list_dialog(std::vector< unit_const_ptr > &units_list)
units_dialog & set_row_num(const std::size_t row_num)
static std::unique_ptr< units_dialog > build_create_dialog(const std::vector< const unit_type * > &types_list)
void dismiss_unit(std::vector< unit_const_ptr > &unit_list, const team &team)
int get_selected_index() const
std::map< std::string_view, std::function< std::string(std::size_t)> > column_generators_
units_dialog & set_column(std::string_view id, const std::vector< Value > &container, const Generator &generator, const bool use_as_sorter=false)
Corresponding to each widget in the row with id 'id', there is a lambda that generates the correspond...
virtual const std::string & window_id() const override
The ID of the window to build.
virtual void pre_show() override
Actions to be taken before showing the window.
void list_item_clicked()
Callbacks.
unit_race::GENDER gender() const
Gender choice from the user.
std::string cancel_label_
units_dialog & set_title(const std::string &title)
static std::unique_ptr< units_dialog > build_recall_dialog(std::vector< unit_const_ptr > &recall_list, const team &team)
void update_gender(const unit_race::GENDER val)
Basic template class to generate new items.
This class stores all the data for a single 'side' (in game nomenclature).
rng * generator
This generator is automatically synced during synced context.
std::size_t index(std::string_view str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.