Skip to content

Commit

Permalink
make treeviws accept toggle_panels too
Browse files Browse the repository at this point in the history
previously they only accepted toggle buttons.
  • Loading branch information
gfgtdf committed Jan 22, 2016
1 parent 58b7691 commit 7e6d7d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/gui/widgets/tree_view_node.cpp
Expand Up @@ -57,19 +57,19 @@ ttree_view_node::ttree_view_node(
node_definition.builder->build(&grid_);
init_grid(&grid_, data);

icon_ = find_widget<ttoggle_button>(
&grid_, "tree_view_node_icon", false, false);
twidget* icon_widget = grid_.find("tree_view_node_icon", false);
icon_ = dynamic_cast<tselectable_*>(icon_widget);

if(icon_) {
icon_->set_visible(twidget::tvisible::hidden);
icon_->connect_signal<event::LEFT_BUTTON_CLICK>(boost::bind(
icon_widget->set_visible(twidget::tvisible::hidden);
icon_widget->connect_signal<event::LEFT_BUTTON_CLICK>(boost::bind(
&ttree_view_node::signal_handler_left_button_click,
this,
_2));
}

if(parent_node_ && parent_node_->icon_) {
parent_node_->icon_->set_visible(
dynamic_cast<twidget&>(*parent_node_->icon_).set_visible(
twidget::tvisible::visible);
}

Expand Down
3 changes: 1 addition & 2 deletions src/gui/widgets/tree_view_node.hpp
Expand Up @@ -23,7 +23,6 @@ namespace gui2
{

class tselectable_;
class ttoggle_button;
class ttree_view;

class ttree_view_node : public twidget
Expand Down Expand Up @@ -226,7 +225,7 @@ class ttree_view_node : public twidget
const std::vector<tnode_definition>& node_definitions_;

/** The icon to show the folded state. */
ttoggle_button* icon_;
tselectable_* icon_;

/** The label to show our selected state. */
tselectable_* label_;
Expand Down

0 comments on commit 7e6d7d4

Please sign in to comment.