15 #ifndef GUI_WIDGETS_LISTBOX_HPP_INCLUDED
16 #define GUI_WIDGETS_LISTBOX_HPP_INCLUDED
18 #ifndef GUI2_EXPERIMENTAL_LISTBOX
34 struct tbuilder_listbox;
35 struct tbuilder_horizontal_listbox;
58 const bool has_maximum,
92 void add_row(
const std::map<std::string /* widget id */, string_map>&
data,
93 const int index = -1);
172 bool select_row(
const unsigned row,
const bool select =
true);
215 const std::vector<twidget*>& call_stack)
override;
237 void set_column_order(
unsigned col,
const std::vector<tgenerator_::torder_func>& func);
278 const std::vector<string_map>& list_data);
311 typedef std::vector<std::pair<tselectable_*, std::vector<tgenerator_::torder_func> > >
torder_list;
329 const int height_modification,
330 const int width__modification_pos = -1,
331 const int height_modification_pos = -1);
virtual void set_content_size(const tpoint &origin, const tpoint &size)
Inherited from tscrollbar_container.
Abstract base class for the generator.
void set_list_builder(tbuilder_grid_ptr list_builder)
void finalize(tbuilder_grid_const_ptr header, tbuilder_grid_const_ptr footer, const std::vector< string_map > &list_data)
Finishes the building initialization of the widget.
void set_row_shown(const unsigned row, const bool shown)
Makes a row visible or invisible.
tbuilder_grid_const_ptr list_builder_
Contains the builder for the new items.
void remove_row(const unsigned row, unsigned count=1)
Removes a row in the listbox.
std::vector< std::pair< tselectable_ *, std::vector< tgenerator_::torder_func > > > torder_list
bool update_content_size()
Request to update the size of the content after changing the content.
friend class tdebug_layout_graph
tresolution(const config &cfg)
virtual const std::string & get_control_type() const override
See tcontrol::get_control_type.
bool select_row(const unsigned row, const bool select=true)
Selectes a row.
tbuilder_grid_ptr list_builder
tplacement
Determines how the items are placed.
void set_row_active(const unsigned row, const bool active)
Makes a row active or inactive.
tbuilder_horizontal_listbox(const config &cfg)
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
tbuilder_listbox(const config &cfg)
std::function< bool(unsigned, unsigned)> torder_func
Base class of a resolution, contains the common keys for a resolution.
virtual void layout_children() override
See twidget::layout_children.
void order_by_column(unsigned column, twidget &widget)
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.
void order_by(const tgenerator_::torder_func &func)
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.
virtual void set_self_active(const bool active) override
See tcontainer_::set_self_active.
tbuilder_grid_ptr list_builder
void handle_key_up_arrow(SDLMod modifier, bool &handled)
Inherited from tscrollbar_container.
tscrollbar_container::tscrollbar_mode vertical_scrollbar_mode
tgenerator_ * generator_
Contains a pointer to the generator.
void set_column_order(unsigned col, const std::vector< tgenerator_::torder_func > &func)
tlistbox(const bool has_minimum, const bool has_maximum, const tgenerator_::tplacement placement, const bool select)
Constructor.
std::vector< string_map > list_data
Listbox data.
void resize_content(const int width_modification, const int height_modification, const int width__modification_pos=-1, const int height_modification_pos=-1)
Resizes the content.
GLuint GLuint GLsizei count
std::map< std::string, t_string > string_map
void handle_key_down_arrow(SDLMod modifier, bool &handled)
Inherited from tscrollbar_container.
GLenum GLenum GLvoid GLvoid * column
tscrollbar_container::tscrollbar_mode horizontal_scrollbar_mode
tlistbox_definition(const config &cfg)
void handle_key_right_arrow(SDLMod modifier, bool &handled)
Inherited from tscrollbar_container.
GLenum GLenum GLvoid * row
std::function< void(twidget &)> callback_value_changed_
This callback is called when the value in the listbox changes.
std::vector< string_map > list_data
Listbox data.
void set_callback_value_change(const std::function< void(twidget &)> &callback)
tscrollbar_container::tscrollbar_mode horizontal_scrollbar_mode
void set_callback_item_change(const std::function< void(size_t)> &callback)
tscrollbar_container::tscrollbar_mode vertical_scrollbar_mode
A config object defines a single node in a WML file, with access to child nodes.
void handle_key_left_arrow(SDLMod modifier, bool &handled)
Inherited from tscrollbar_container.
void list_item_clicked(twidget &caller)
Function to call after the user clicked on a row.
virtual void child_populate_dirty_list(twindow &caller, const std::vector< twidget * > &call_stack) override
See twidget::child_populate_dirty_list.
int get_selected_row() const
Returns the first selected row.
GLsizei const GLcharARB ** string
virtual void place(const tpoint &origin, const tpoint &size) override
See twidget::place.
void clear()
Removes all the rows in the listbox, clearing it.
const tgrid * get_row_grid(const unsigned row) const
Returns the grid of the wanted row.
Contains the implementation details for lexical_cast and shouldn't be used directly.
std::function< void(size_t)> callback_item_changed_
This callback is called when a list item is clicked (toggled).