29 class selectable_item;
38 using ptr_t = std::shared_ptr<tree_view_node>;
47 const std::string&
id,
50 const std::map<std::string /* widget id */, string_map>& data);
70 const std::map<std::string /* widget id */, string_map>& data,
73 return add_child_impl(std::make_shared<tree_view_node>(
id,
this, get_tree_view(), data),
index);
86 return add_child_impl(std::move(new_node),
index);
104 const std::map<std::string /* widget id */, string_map>& data)
106 assert(!is_root_node());
107 return parent_node().
add_child(
id, data);
126 return parent_node_ ==
nullptr;
134 unsigned get_indentation_level()
const;
139 return children_.empty();
157 void fold(
const bool recursive =
false);
158 void unfold(
const bool recursive =
false);
174 assert(!is_root_node());
180 const bool must_be_active)
override;
183 virtual const widget* find_at(
const point& coordinate,
184 const bool must_be_active)
const override;
187 widget* find(
const std::string&
id,
const bool must_be_active)
override;
190 const widget* find(
const std::string&
id,
191 const bool must_be_active)
const override;
198 return children_.size();
233 std::vector<int> describe_path();
240 void select_node(
bool expand_parents =
false);
242 void layout_initialize(
const bool full_initialization)
override;
244 void clear_before_destruct();
247 int calculate_ypos();
250 virtual void request_reduce_width(
const unsigned maximum_width)
override;
279 void fold_internal();
280 void unfold_internal();
287 void impl_populate_dirty_list(
window& caller,
291 virtual point calculate_best_size()
const override;
294 bool disable_click_dismiss()
const override;
296 point calculate_best_size(
const int indentation_level,
297 const unsigned indentation_step_size)
const;
299 point get_current_size(
bool assume_visible =
false)
const;
300 point get_folded_size()
const;
301 point get_unfolded_size()
const;
304 virtual void set_origin(
const point& origin)
override;
307 virtual void place(
const point& origin,
const point&
size)
override;
310 place(
const unsigned indentation_step_size,
point origin,
unsigned width);
313 virtual void set_visible_rectangle(
const SDL_Rect& rectangle)
override;
316 virtual void impl_draw_children(
surface& frame_buffer,
318 int y_offset)
override;
323 void signal_handler_label_left_button_click(
const event::ui_event event,
329 const std::map<std::string /* widget id */, string_map>& data);
337 const std::string& get_control_type()
const;
Small abstract helper class.
tree_view_node * parent_node_
Our parent node.
bool is_root_node() const
Is this node the root node?
tree_view_node & add_child(ptr_t new_node, const int index=-1)
Adds a previously-constructed node as a child of this node at the given position. ...
selectable_item * toggle_
The toggle for the folded state.
void clear(const std::string &key)
const tree_view & get_tree_view() const
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.
std::shared_ptr< tree_view_node > ptr_t
The walker abstract base class.
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()
node_children_vector & siblings()
tree_view_node & add_sibling(const std::string &id, const std::map< std::string, string_map > &data)
Adds a sibbling for a node at the end of the list.
tree_view * tree_view_
The tree view that owns us.
map_location coordinate
Contains an x and y coordinate used for starting positions in maps.
std::vector< ptr_t > node_children_vector
tree_view_node & add_child(const std::string &id, const std::map< std::string, string_map > &data, const int index=-1)
Constructs a new child node.
base class of top level items, the only item which needs to store the final canvases to draw on...
static std::deque< std::string > call_stack
Contains the implementation details for lexical_cast and shouldn't be used directly.
ui_event
The event send to the dispatcher.