30 class selectable_item;
47 const std::string&
id,
73 return add_child_impl(std::make_shared<tree_view_node>(
id,
this, get_tree_view(), data),
index);
85 std::vector<std::shared_ptr<gui2::tree_view_node>> replace_children(
const std::string&
id,
const std::vector<widget_data>& data);
97 return add_child_impl(std::move(new_node),
index);
117 assert(!is_root_node());
118 return parent_node().
add_child(
id, data);
123 tree_view_node& add_child_impl(std::shared_ptr<tree_view_node>&& new_node,
const int index);
137 return parent_node_ ==
nullptr;
145 unsigned get_indentation_level()
const;
150 return children_.empty();
168 void fold(
const bool recursive =
false);
169 void unfold(
const bool recursive =
false);
185 assert(!is_root_node());
191 const bool must_be_active)
override;
194 virtual const widget* find_at(
const point& coordinate,
195 const bool must_be_active)
const override;
198 widget* find(
const std::string&
id,
const bool must_be_active)
override;
201 const widget* find(
const std::string&
id,
202 const bool must_be_active)
const override;
209 return children_.size();
244 std::vector<int> describe_path();
251 void select_node(
bool expand_parents =
false);
253 void layout_initialize(
const bool full_initialization)
override;
255 void clear_before_destruct();
258 int calculate_ypos();
261 virtual void request_reduce_width(
const unsigned maximum_width)
override;
290 void fold_internal();
291 void unfold_internal();
294 virtual point calculate_best_size()
const override;
297 bool disable_click_dismiss()
const override;
299 point calculate_best_size(
const int indentation_level,
300 const unsigned indentation_step_size)
const;
302 point get_current_size(
bool assume_visible =
false)
const;
303 point get_folded_size()
const;
304 point get_unfolded_size()
const;
307 virtual void set_origin(
const point& origin)
override;
310 virtual void place(
const point& origin,
const point&
size)
override;
313 place(
const unsigned indentation_step_size,
point origin,
unsigned width);
316 virtual void set_visible_rectangle(
const SDL_Rect& rectangle)
override;
319 virtual void impl_draw_children()
override;
324 void signal_handler_label_left_button_click(
const event::ui_event event,
338 const std::string& get_control_type()
const;
Small abstract helper class.
tree_view_node * parent_node_
Our parent node.
std::unique_ptr< class walker_base > walker_ptr
std::vector< std::shared_ptr< tree_view_node > > node_children_vector
bool is_root_node() const
Is this node the root node?
ui_event
The event sent to the dispatcher.
selectable_item * toggle_
The toggle for the folded state.
void clear(const std::string &key)
tree_view_node & add_child(std::shared_ptr< tree_view_node > new_node, const int index=-1)
Adds a previously-constructed node as a child of this node at the given position. ...
const tree_view & get_tree_view() const
tree_view_node & add_child(const std::string &id, const widget_data &data, const int index=-1)
Constructs a new child node.
std::size_t count_children() const
The number of children in this widget.
bool empty() const
Does the node have children?
bool operator==(const tree_view_node &node)
bool is_folded() const
Is the node folded?
node_children_vector children_
Our children.
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
grid grid_
Grid holding our contents.
A tree view is a control that holds several items of the same or different types. ...
selectable_item * label_
The label to show our selected state.
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.
tree_view & get_tree_view()
node_children_vector & children()
tree_view_node & add_sibling(const std::string &id, const widget_data &data)
Adds a sibbling for a node at the end of the list.
node_children_vector & siblings()
tree_view * tree_view_
The tree view that owns us.
std::map< std::string, widget_item > widget_data
map_location coordinate
Contains an x and y coordinate used for starting positions in maps.
Contains the implementation details for lexical_cast and shouldn't be used directly.