From 474feee1db323f45fb121b02d76e776cb5c7c2f1 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Fri, 27 Apr 2012 02:03:48 +0000 Subject: o Added FL_TREE_ITEM_HEIGHT_FROM_WIDGET option to item_draw_mode() to allow widgets to control the size of items in the tree (instead of vice versa). o Added item_draw_mode(int) to allow for easier bitflag maintenance, since enums don't seem to be typesafe yet. o Tree demo modified to demonstrate this feature. An important feature for adding large widgets to tree items. Will probably add an example, 'tree-of-tables' to demo this usage. o Small doc fixes. o Had to rename FL_TREE_ITEM_DRAW_WIDGET_ONLY to FL_TREE_ITEM_DRAW_DEFAULT. Its meaning for the bit fields changed when new bit fields were added. (The prev name just didn't make sense in the new context. Since it was just a few svn commits old and an unreleased ABI feature, it shouldn't affect anyone not in R&D) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9404 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Tree.H | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'FL/Fl_Tree.H') diff --git a/FL/Fl_Tree.H b/FL/Fl_Tree.H index e934963a0..a53560f8b 100644 --- a/FL/Fl_Tree.H +++ b/FL/Fl_Tree.H @@ -52,9 +52,9 @@ /// |--- Fl_Tree_Sort (enum) // Sort behavior /// \endcode /// -/// Similar to Fl_Browser, Fl_Tree is a browser of Fl_Tree_Item's, which is arranged -/// in a parented hierarchy, or 'tree'. Subtrees can be expanded or closed. Items can be -/// added, deleted, inserted, sorted and re-ordered. +/// Similar to Fl_Browser, Fl_Tree is a browser of Fl_Tree_Item's arranged +/// in a parented hierarchy, or 'tree'. Subtrees can be expanded or closed. +/// Items can be added, deleted, inserted, sorted and re-ordered. /// /// The tree items may also contain other FLTK widgets, like buttons, input fields, /// or even "custom" widgets. @@ -100,13 +100,23 @@ /// FLTK widgets (including custom widgets) can be assigned to tree items via /// Fl_Tree_Item::widget(). /// -/// Icons for individual items can be changed with -/// Fl_Tree_Item::openicon(), -/// Fl_Tree_Item::closeicon(), -/// Fl_Tree_Item::usericon(). +/// When a widget() is defined, the default behavior is for the widget() +/// to be shown in place of the item's label (if it has one). +/// Only the widget()'s width will be used; the widget()'s x() and y() position +/// will be managed by the tree, and the h() will track the item's height. +/// This default behavior can be altered: +/// Setting Fl_Tree::item_draw_mode()'s FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET flag +/// causes the label + widget to be displayed together in that order, and +/// adding the FL_TREE_ITEM_HEIGHT_FROM_WIDGET flag causes widget's height +/// to define the widget()'s height. +/// +/// The tree's open/close icons can be redefined with +/// Fl_Tree::openicon(), Fl_Tree::closeicon(). User icons +/// can either be changed globally with Fl_Tree::usericon(), +/// or on a per-item basis with Fl_Tree_Item::usericon(). /// /// Various default preferences can be globally manipulated via Fl_Tree_Prefs, -/// including colors, margins, icons, connection lines. +/// including colors, margins, icons, connection lines, etc. /// /// The tree's callback() will be invoked when items change state or are open/closed. /// when() controls when mouse/keyboard events invoke the callback. @@ -125,7 +135,7 @@ /// } /// \endcode /// -/// To get the item's full menu pathname, you can use Fl_Tree_Item::item_pathname(), eg: +/// To get the item's full menu pathname, you can use Fl_Tree::item_pathname(), eg: /// /// \code /// char pathname[256] = "???"; @@ -415,6 +425,7 @@ public: void item_reselect_mode(Fl_Tree_Item_Reselect_Mode mode); Fl_Tree_Item_Draw_Mode item_draw_mode() const; void item_draw_mode(Fl_Tree_Item_Draw_Mode mode); + void item_draw_mode(int mode); #endif int displayed(Fl_Tree_Item *item); -- cgit v1.2.3