summaryrefslogtreecommitdiff
path: root/test/tree.fl
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2016-07-21 00:51:14 +0000
committerGreg Ercolano <erco@seriss.com>2016-07-21 00:51:14 +0000
commite92fa6914b0a3f50621aa57bdf9b7e59a22904fc (patch)
treed211329ebf90db738d2ff742f350291021512b93 /test/tree.fl
parentaa5ac8656d89626841f1e236d0883577537736db (diff)
Bringing over fix [r11840] from 1.3 current to the porting branch.
Solves STR#3294; added methods to let user set the userdeicon, and removed the performance degrading automatic deicon creation. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11841 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/tree.fl')
-rw-r--r--test/tree.fl36
1 files changed, 28 insertions, 8 deletions
diff --git a/test/tree.fl b/test/tree.fl
index 8fb93fb8b..d1f253ba3 100644
--- a/test/tree.fl
+++ b/test/tree.fl
@@ -98,7 +98,7 @@ Function {AssignUserIcons()} {
"@xxxxxxxxx@",
"@xxxxxxxxx@",
"@@@@@@@@@@@"};
-static Fl_Pixmap L_folderpixmap(L_folder_xpm);
+static Fl_Pixmap L_folder_pixmap(L_folder_xpm);
static const char *L_document_xpm[] = {
"11 11 3 1",
@@ -116,18 +116,38 @@ static const char *L_document_xpm[] = {
".@xxxxxxx@.",
".@xxxxxxx@.",
".@@@@@@@@@."};
-static Fl_Pixmap L_documentpixmap(L_document_xpm);
+static Fl_Pixmap L_document_pixmap(L_document_xpm);
+
+// Create deactivated version of document icon
+static Fl_Pixmap L_folder_deicon_pixmap(L_folder_xpm); // copy
+static Fl_Pixmap L_document_deicon_pixmap(L_document_xpm); // copy
+static int first = 1;
+if ( first ) {
+ L_folder_deicon_pixmap.inactive();
+ L_document_deicon_pixmap.inactive();
+ first = 0;
+}
// Assign user icons to tree items
-for ( Fl_Tree_Item *item = tree->first(); item; item=item->next())
- if ( usericon_radio->value() )
+for ( Fl_Tree_Item *item = tree->first(); item; item=item->next()) {
+ if ( usericon_radio->value() ) {
// Assign custom icons
- item->usericon(item->has_children() ? &L_folderpixmap : &L_documentpixmap);
- else
+ if ( item->has_children() ) {
+ item->usericon(&L_folder_pixmap);
+ item->userdeicon(&L_folder_deicon_pixmap);
+ } else {
+ item->usericon(&L_document_pixmap);
+ item->userdeicon(&L_document_deicon_pixmap);
+ }
+ } else {
// Don't assign custom icons
item->usericon(0);
-tree->redraw();} {}
+ item->userdeicon(0);
+ }
+}
+tree->redraw();} {selected
+ }
}
Function {RebuildTree()} {
@@ -1233,7 +1253,7 @@ If none are selected, all are set.} xywh {758 134 100 16} selection_color 1 labe
callback {if ( deactivate_tree_toggle->value() )
tree->deactivate();
else
- tree->activate();} selected
+ tree->activate();}
tooltip {Deactivates the entire tree widget} xywh {758 154 100 16} selection_color 1 labelsize 9
}
Fl_Light_Button bold_toggle {