summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
Diffstat (limited to 'FL')
-rw-r--r--FL/Fl_Tree.H1
-rw-r--r--FL/Fl_Tree_Item.H15
2 files changed, 16 insertions, 0 deletions
diff --git a/FL/Fl_Tree.H b/FL/Fl_Tree.H
index 00d92e88e..7404d8936 100644
--- a/FL/Fl_Tree.H
+++ b/FL/Fl_Tree.H
@@ -415,6 +415,7 @@ public:
int deselect_all(Fl_Tree_Item *item=0);
int select_only(Fl_Tree_Item *selitem);
+ int select_all(Fl_Tree_Item *item=0);
/// See if the specified item is selected.
/// \return
diff --git a/FL/Fl_Tree_Item.H b/FL/Fl_Tree_Item.H
index 674955cd4..b10b1e838 100644
--- a/FL/Fl_Tree_Item.H
+++ b/FL/Fl_Tree_Item.H
@@ -221,6 +221,21 @@ public:
select(); // select if deselected
}
}
+ /// Select self and all children
+ /// Returns count of how many items were in the 'deselected' state,
+ /// ie. how many items were "changed".
+ ///
+ int select_all() {
+ int count = 0;
+ if ( ! is_selected() ) {
+ select();
+ ++count;
+ }
+ for ( int t=0; t<children(); t++ ) {
+ count += child(t)->select_all();
+ }
+ return(count);
+ }
/// Disable the item's selection state.
void deselect() {
_selected = 0;