23 #include <boost/dynamic_bitset.hpp> 30 class selectable_item;
33 struct builder_listbox;
34 struct builder_horizontal_listbox;
35 struct builder_grid_listbox;
36 struct builder_styled_widget;
45 friend class debug_layout_graph;
62 const bool has_minimum,
63 const bool has_maximum,
64 const bool select =
true);
96 grid& add_row(
const std::map<std::string /* widget id */, string_map>& data,
const int index = -1);
106 void remove_row(
const unsigned row,
unsigned count = 1);
112 unsigned get_item_count()
const;
122 void set_row_active(
const unsigned row,
const bool active);
130 void set_row_shown(
const unsigned row,
const bool shown);
144 void set_row_shown(
const boost::dynamic_bitset<>& shown);
151 boost::dynamic_bitset<> get_rows_shown()
const;
153 bool any_rows_shown()
const;
167 const grid* get_row_grid(
const unsigned row)
const;
176 grid* get_row_grid(
const unsigned row);
185 bool select_row(
const unsigned row,
const bool select =
true);
194 return select_row(get_item_count() - 1, select);
213 bool select_row_at(
const unsigned row,
const bool select =
true);
220 bool row_selected(
const unsigned row);
227 int get_selected_row()
const;
230 void list_item_clicked(
widget& caller);
233 virtual void set_self_active(
const bool active)
override;
249 bool update_content_size();
254 virtual void place(
const point& origin,
const point&
size)
override;
257 virtual void layout_children()
override;
260 virtual void child_populate_dirty_list(
window& caller,
const std::vector<widget*>&
call_stack)
override;
268 template<
typename Func>
271 set_column_order(col, {{
272 [
f](
int lhs,
int rhs) {
return f(lhs) <
f(rhs); },
273 [
f](
int lhs,
int rhs) {
return f(lhs) >
f(rhs); }
301 void set_active_sorting_option(
const order_pair& sort_by,
const bool select_first =
false);
306 void mark_as_unsorted();
311 callback_order_change_ = callback;
318 void handle_key_up_arrow(SDL_Keymod modifier,
bool& handled)
override;
321 void handle_key_down_arrow(SDL_Keymod modifier,
bool& handled)
override;
324 void handle_key_left_arrow(SDL_Keymod modifier,
bool& handled)
override;
327 void handle_key_right_arrow(SDL_Keymod modifier,
bool& handled)
override;
331 virtual point calculate_best_size()
const override;
361 const std::vector<std::map<std::string, string_map>>& list_data);
378 typedef std::vector<std::pair<selectable_item*, generator_sort_array>>
torder_list;
398 void resize_content(
const int width_modification,
399 const int height_modification,
400 const int width__modification_pos = -1,
401 const int height_modification_pos = -1);
410 void resize_content(
const widget& row);
413 void layout_children(
const bool force);
416 virtual void set_content_size(
const point& origin,
const point& size)
override;
420 static const std::string&
type();
424 virtual const std::string& get_control_type()
const override;
469 std::vector<std::map<std::string, string_map>>
list_data;
493 std::vector<std::map<std::string, string_map>>
list_data;
517 std::vector<std::map<std::string, string_map>>
list_data;
Base class of a resolution, contains the common keys for a resolution.
std::function< void(unsigned, SORT_ORDER)> callback_order_change_
std::shared_ptr< const builder_grid > builder_grid_const_ptr
scrollbar_container::scrollbar_mode horizontal_scrollbar_mode
scrollbar_container::scrollbar_mode horizontal_scrollbar_mode
std::function< bool(unsigned, unsigned)> order_func
void clear(const std::string &key)
bool select_last_row(const bool select=true)
Does exactly as advertised: selects the list's last row.
std::pair< int, SORT_ORDER > order_pair
void set_callback_order_change(std::function< void(unsigned, SORT_ORDER)> callback)
Registers a callback to be called when the active sorting option changes.
scrollbar_container::scrollbar_mode vertical_scrollbar_mode
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
scrollbar_container::scrollbar_mode horizontal_scrollbar_mode
Abstract base class for the generator.
std::vector< std::pair< selectable_item *, generator_sort_array > > torder_list
std::vector< std::map< std::string, string_map > > list_data
Listbox data.
builder_grid_const_ptr list_builder_
Contains the builder for the new items.
placement
Determines how the items are placed.
builder_grid_ptr list_builder
builder_grid_ptr list_builder
std::vector< std::map< std::string, string_map > > list_data
Listbox data.
window * build(const builder_window::window_resolution *definition)
Builds a window.
std::array< generator_base::order_func, 2 > generator_sort_array
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
std::vector< std::map< std::string, string_map > > list_data
Listbox data.
const bool is_horizontal_
builder_grid_ptr list_builder
generator_base * generator_
Contains a pointer to the generator.
void register_sorting_option(const int col, const Func &f)
A config object defines a single node in a WML file, with access to child nodes.
std::function< std::string(const int)> translatable_sorter_func_t
scrollbar_container::scrollbar_mode vertical_scrollbar_mode
base class of top level items, the only item which needs to store the final canvases to draw on ...
std::shared_ptr< builder_grid > builder_grid_ptr
static std::deque< std::string > call_stack
scrollbar_container::scrollbar_mode vertical_scrollbar_mode
Contains the implementation details for lexical_cast and shouldn't be used directly.