Greg Ercolano wrote:
imm wrote:
Eric Sokolowsky wrote:
1. A built-in hierarchical tree browser widget
Just for the record, Greg has a tree widget too - I mention this only
because the FLU stuff (of which I am generally a fan) seem to be
unmaintained now...
http://seriss.com/people/erco/fltk/Fl_Tree/
Right -- it's a rewrite, though I did refer to FLU's feature set
to make sure I wasn't missing anything obvious.
Fl_Tree is still a pre-1.0 state, but it's main functions seem
to work well.
The vertical scrollbar works normally, but currently there's no
horizontal scrollbar yet.
You can also put widgets inside the tree. This hasn't been
well tested, but the demo works.
If you try it, let me know if you have any trouble or questions.
Greg - We switched from the FLU tree widget to Fl_Tree in Gmsh. Fl_Tree
is definitely more stable.
The only feature we were missing was the ability to store user data in
the nodes. Attached is a small patch that adds that capability + makes
Fl_Tree compile with FLTK versions older than 1.1.9.
Thanks again for this widget: it was really the biggest "missing" widget
in FLTK.
Christophe
PS - On the wishlist for a future version: make it more efficient for
very large trees ;-)
diff -u -r /Users/geuzaine/src/Fl_Tree-0.71/FL/Fl_Tree_Item.H
./FL/Fl_Tree_Item.H
--- /Users/geuzaine/src/Fl_Tree-0.71/FL/Fl_Tree_Item.H 2009-06-04
14:05:43.000000000 +0200
+++ ./FL/Fl_Tree_Item.H 2009-08-16 02:28:16.000000000 +0200
@@ -68,6 +68,7 @@
int _label_xywh[4]; // xywh of label
Fl_Widget *_widget; // item's label widget
(optional)
Fl_Pixmap *_usericon; // item's user-specific icon
(optional)
+ void *_userdata; // item's user-specific data
(optional) GMSH
Fl_Tree_Item_Array _children; // array of child items
Fl_Tree_Item *_parent; // parent item (=0 if root)
protected:
@@ -276,6 +277,14 @@
Fl_Pixmap *usericon() const {
return(_usericon);
}
+ /// Set the user data.
+ void userdata(void *val) {
+ _userdata = val;
+ }
+ /// Get the user data.
+ void *userdata() const {
+ return(_userdata);
+ }
//////////////////
// Events
//////////////////
diff -u -r /Users/geuzaine/src/Fl_Tree-0.71/Fl_Tree_Item.cxx ./Fl_Tree_Item.cxx
--- /Users/geuzaine/src/Fl_Tree-0.71/Fl_Tree_Item.cxx 2009-06-04
14:05:43.000000000 +0200
+++ ./Fl_Tree_Item.cxx 2009-08-16 12:17:18.000000000 +0200
@@ -60,6 +60,7 @@
_label_xywh[2] = 0;
_label_xywh[3] = 0;
_usericon = 0;
+ _userdata = 0; // GMSH
_parent = 0;
}
diff -u -r /Users/geuzaine/src/Fl_Tree-0.71/Fl_Tree_Prefs.cxx
./Fl_Tree_Prefs.cxx
--- /Users/geuzaine/src/Fl_Tree-0.71/Fl_Tree_Prefs.cxx 2009-06-04
14:05:43.000000000 +0200
+++ ./Fl_Tree_Prefs.cxx 2009-09-01 16:51:11.000000000 +0200
@@ -1,3 +1,4 @@
+#include <string.h>
#include <FL/Fl.H>
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_Tree_Prefs.H>
@@ -112,7 +113,12 @@
// Let fltk's current 'scheme' affect defaults
if ( Fl::scheme() ) {
if ( strcmp(Fl::scheme(), "gtk+") == 0 ) {
- _selectbox = _FL_GTK_THIN_UP_BOX;
+#if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 1) && (FL_PATCH_VERSION <
9)
+ // GMSH PATCH for fltk < 1.1.9 compat
+ _selectbox = FL_FLAT_BOX;
+#else
+ _selectbox = _FL_GTK_THIN_UP_BOX;
+#endif
} else if ( strcmp(Fl::scheme(), "plastic") == 0 ) {
_selectbox = _FL_PLASTIC_THIN_UP_BOX;
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk