add unfolded=yes/no key in gui2 treeview node wml
This allows wml to specify whether a node should be unfolded by default.
This commit is contained in:
parent
21001bcb32
commit
d26c2b6043
3 changed files with 9 additions and 1 deletions
|
@ -79,7 +79,9 @@ twidget* tbuilder_tree_view::build() const
|
|||
}
|
||||
|
||||
tbuilder_tree_view::tnode::tnode(const config& cfg)
|
||||
: id(cfg["id"]), builder(NULL)
|
||||
: id(cfg["id"])
|
||||
, unfolded(cfg["unfolded"].to_bool(false))
|
||||
, builder(NULL)
|
||||
{
|
||||
VALIDATE(!id.empty(), missing_mandatory_wml_key("node", "id"));
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ struct tbuilder_tree_view : public tbuilder_control
|
|||
explicit tnode(const config& cfg);
|
||||
|
||||
std::string id;
|
||||
bool unfolded;
|
||||
tbuilder_grid_ptr builder;
|
||||
};
|
||||
|
||||
|
|
|
@ -74,6 +74,11 @@ ttree_view_node::ttree_view_node(
|
|||
&ttree_view_node::signal_handler_left_button_click,
|
||||
this,
|
||||
_2), event::tdispatcher::back_post_child);
|
||||
|
||||
if(node_definition.unfolded) {
|
||||
toggle_->set_value(1);
|
||||
unfolded_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(parent_node_ && parent_node_->toggle_) {
|
||||
|
|
Loading…
Add table
Reference in a new issue