15 #define GETTEXT_DOMAIN "wesnoth-lib"
30 #define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__
31 #define LOG_HEADER LOG_SCOPE_HEADER + ':'
42 , node_definitions_(node_definitions)
43 , indention_step_size_(0)
50 , selected_item_(
nullptr)
51 , selection_change_callback_()
53 connect_signal<event::LEFT_BUTTON_DOWN>(
60 const std::map<std::string /* widget id */, string_map>&
data)
93 const std::vector<twidget*>& call_stack)
118 const int height_modification,
119 const int width__modification_pos,
120 const int height_modification_pos)
123 <<
" width_modification " << width_modification
124 <<
" height_modification " << height_modification <<
".\n";
126 if(
content_resize_request(width_modification, height_modification, width__modification_pos, height_modification_pos)) {
130 size.
x += width_modification;
131 size.
y += height_modification;
139 if(width_modification < 0 || height_modification < 0) {
191 template<ttree_view_node* (ttree_view_node::*func) ()>
199 if(visible != selected) {
202 return (selected->*func)();
205 template<ttree_view_node* (ttree_view_node::*func) ()>
212 SDL_Rect rect =
next->get_grid().get_rectangle();
223 if(handle_up_down_arrow<&ttree_view_node::get_selectable_node_above>()) {
233 if(handle_up_down_arrow<&ttree_view_node::get_selectable_node_below>()) {
256 if(!selected || !selected->
is_folded()) {
269 DBG_GUI_P <<
"Parsing tree view " <<
id <<
'\n';
271 load_resolutions<tresolution>(cfg);
370 tbuilder_tree_view::tbuilder_tree_view(
const config& cfg)
372 , vertical_scrollbar_mode(
374 , horizontal_scrollbar_mode(
376 , indention_step_size(cfg[
"indention_step_size"])
403 DBG_GUI_G <<
"Window builder: placed tree_view '" <<
id
404 <<
"' with definition '" <<
definition <<
"'.\n";
420 , unfolded(cfg[
"unfolded"].to_bool(false))
426 _(
"[node]id 'root' is reserved for the implementation."));
428 const config& node_definition = cfg.
child(
"node_definition");
430 VALIDATE(node_definition,
_(
"No node defined."));
Define the common log macros for the gui toolkit.
child_itors child_range(const std::string &key)
tscrollbar_container::tscrollbar_mode horizontal_scrollbar_mode
const std::vector< node > & nodes
unsigned indention_step_size_
bool empty() const
Does the node have children?
Add a special kind of assert to validate whether the input from WML doesn't contain any problems that...
bool is_folded() const
Is the node folded?
GLuint GLuint GLsizei GLenum type
bool handle_up_down_arrow()
tresolution_definition_ptr config()
tresolution(const config &cfg)
ttree_view_node * selected_item()
tscrollbar_container::tscrollbar_mode vertical_scrollbar_mode
static const unsigned VERTICAL_GROW_SEND_TO_CLIENT
static const unsigned HORIZONTAL_GROW_SEND_TO_CLIENT
void set_indention_step_size(const unsigned indention_step_size)
virtual void finalize_setup()
Inherited from tcontainer_.
virtual const std::string & get_control_type() const override
See tcontrol::get_control_type.
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
tscrollbar_container::tscrollbar_mode get_scrollbar_mode(const std::string &scrollbar_mode)
Returns the scrollbar mode flags.
ttree_view_node & add_child(const std::string &id, const std::map< std::string, string_map > &data, const int index=-1)
Adds a child item to the list of child nodes.
void handle_key_down_arrow(SDLMod modifier, bool &handled)
Inherited from tscrollbar_container.
Base class of a resolution, contains the common keys for a resolution.
ttree_view_node * root_node_
std::string missing_mandatory_wml_key(const std::string §ion, const std::string &key, const std::string &primary_key, const std::string &primary_value)
Returns a standard message for a missing wml key.
base class of top level items, the only item which needs to store the final canvases to draw on ...
ttree_view_node & add_node(const std::string &id, const std::map< std::string, string_map > &data)
A class inherited from ttext_box that displays its input as stars.
void init_control(tcontrol *control) const
std::string definition
Parameters for the control.
std::vector< ttree_node > nodes
The types of nodes in the tree view.
static UNUSEDNOWARN std::string _(const char *str)
virtual void set_self_active(const bool active) override
See tcontainer_::set_self_active.
#define VALIDATE(cond, message)
The macro to use for the validation of WML.
virtual void set_visible_rectangle(const SDL_Rect &rectangle) override
See twidget::set_visible_rectangle.
tbuilder_grid_ptr builder
void handle_key_left_arrow(SDLMod modifier, bool &handled)
Inherited from tscrollbar_container.
boost::ptr_vector< ttree_view_node > children_
Our children.
void impl_populate_dirty_list(twindow &caller, const std::vector< twidget * > &call_stack)
"Inherited" from twidget.
void init_grid(const boost::intrusive_ptr< tbuilder_grid > &grid_builder)
Initializes and builds the grid.
tevent
The event send to the dispatcher.
Contains the state info for a resolution.
std::map< std::string, t_string > string_map
ttree_view_definition(const config &cfg)
void signal_handler_left_button_down(const event::tevent event)
std::map< std::string, tfilter >::iterator itor
void handle_key_up_arrow(SDLMod modifier, bool &handled)
Inherited from tscrollbar_container.
ttree_view_node & get_root_node()
unsigned indention_step_size
GLint GLint GLint GLint GLint x
ttree_node(const config &cfg)
void handle_key_right_arrow(SDLMod modifier, bool &handled)
Inherited from tscrollbar_container.
virtual void place(const tpoint &origin, const tpoint &size) override
See twidget::place.
void set_rows_cols(const unsigned rows, const unsigned cols)
Wrapper to set_rows and set_cols.
std::vector< tstate_definition > state
config & child(const std::string &key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
ttree_view_node * get_next_node()
ttree_view_node * parent_node_
Our parent node.
void remove_node(ttree_view_node *tree_view_node)
void set_child(twidget *widget, const unsigned row, const unsigned col, const unsigned flags, const unsigned border_size)
Sets a child in the grid.
void keyboard_capture(twidget *widget)
A config object defines a single node in a WML file, with access to child nodes.
ttree_view_node * get_last_visible_parent_node()
virtual void layout_children() override
See twidget::layout_children.
GLsizei const GLcharARB ** string
Contains the implementation details for lexical_cast and shouldn't be used directly.
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.
virtual void child_populate_dirty_list(twindow &caller, const std::vector< twidget * > &call_stack) override
See twidget::child_populate_dirty_list.