From 2c5006563f893723f0f224d7b3115e5fd03272ca Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Sun, 30 Jan 2011 20:22:06 +0000 Subject: Fl_Tree API breaking changes (we haven't released 1.3.0 yet..): Fl_Tree::labelsize() -> item_labelsize() -- TO AVOID COLLISION WITH Fl_Widget::labelsize()! Fl_Tree::labelfont() -> item_labelfont() -- TO AVOID COLLISION WITH Fl_Widget::labelfont()! Fl_Tree_Prefs (internal) changes: Fl_Tree_Prefs::fgcolor() -> labelfgcolor() -- for consistency with above Fl_Tree_Prefs::bgcolor() -> labelbgcolor() -- for consistency with above Fl_Tree_Prefs::selectcolor() removed -- uses Fl_Widget::selection_color() instead Fl_Tree_Prefs::inactivecolor() removed -- was unused; inactive color procedurally calculated Other Fl_Tree mods: o Fixed bug with select_all(item) and deselect_all(item) (they were not limiting themselves to children of specified item) o Fixed bug with item not drawing in its /own/ bgcolor when item selected o Fl_Tree uses the Fl_Widget::selection_color() o All methods that deal with 'font types' changed int -> Fl_Font o All methods that deal with 'font sizes' changed int -> Fl_Fontsize o Added needed methods to Fl_Tree for accessing colors: item_labelfgcolor() -- access default fg color used for new items item_labelbgcolor() -- access default bg color used for new items tree_connectorcolor() -- access the connector line color o Small doxygen comment adjustments and general clarifications o test/tree demo modified to include testing of new label color methods, cleanup git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8340 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Tree.H | 63 +++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 20 deletions(-) (limited to 'FL/Fl_Tree.H') diff --git a/FL/Fl_Tree.H b/FL/Fl_Tree.H index af25e2312..82185d56a 100644 --- a/FL/Fl_Tree.H +++ b/FL/Fl_Tree.H @@ -97,6 +97,7 @@ /// next_selected_item(). /// Items can be found by their pathname using find_item(const char*), /// and an item's pathname can be found with item_pathname(). +/// The selected items' colors are controlled by selection_color() (inherited from Fl_Widget). /// /// The tree can have different selection behaviors controlled by selectmode(). /// @@ -604,36 +605,57 @@ public: ///////////////////////////////// /// Get the default label fontsize used for creating new items. - int labelsize() const { + Fl_Fontsize item_labelsize() const { return(_prefs.labelsize()); } /// Set the default label font size used for creating new items. - /// To change the font size on a per-item basis, use Fl_Tree_Item::labelsize(int) + /// To change the font size on a per-item basis, use Fl_Tree_Item::labelsize(Fl_Fontsize) /// - void labelsize(int val) { + void item_labelsize(Fl_Fontsize val) { _prefs.labelsize(val); } - - /// Get the default font face used for item's labels when new items are created. - /// - /// Don't use this if you want to change an existing label() size; use - /// item->labelfont() instead. - /// - int labelfont() const { + /// Get the default font face used for creating new items. + Fl_Font item_labelfont() const { return(_prefs.labelfont()); } - /// Set the default font face used for item's labels when new items are created. - /// - /// Don't use this if you want to change an existing label() size; use - /// item->labelfont(int) instead. + /// Set the default font face used for creating new items. + /// To change the font face on a per-item basis, use Fl_Tree_Item::labelfont(Fl_Font) /// - void labelfont(int val) { + void item_labelfont(Fl_Font val) { _prefs.labelfont(val); } + /// Get the default label foreground color used for creating new items. + Fl_Color item_labelfgcolor(void) const { + return(_prefs.labelfgcolor()); + } + /// Set the default label foreground color used for creating new items. + /// To change the foreground color on a per-item basis, use Fl_Tree_Item::labelfgcolor(Fl_Color) + /// + void item_labelfgcolor(Fl_Color val) { + _prefs.labelfgcolor(val); + } + /// Get the default label background color used for creating new items. + Fl_Color item_labelbgcolor(void) const { + return(_prefs.labelbgcolor()); + } + /// Set the default label background color used for creating new items. + /// To change the background color on a per-item basis, use Fl_Tree_Item::labelbgcolor(Fl_Color) + /// + void item_labelbgcolor(Fl_Color val) { + _prefs.labelbgcolor(val); + } + /// Get the connector color used for tree connection lines. + Fl_Color connectorcolor() const { + return(_prefs.connectorcolor()); + } + /// Set the connector color used for tree connection lines. + void connectorcolor(Fl_Color val) { + _prefs.connectorcolor(val); + } /// Get the amount of white space (in pixels) that should appear /// between the widget's left border and the tree's contents. /// - int marginleft() const { + int marginleft() const { return(_prefs.marginleft()); } /// Set the amount of white space (in pixels) that should appear @@ -646,7 +668,7 @@ public: /// Get the amount of white space (in pixels) that should appear /// between the widget's top border and the top of the tree's contents. /// - int margintop() const { + int margintop() const { return(_prefs.margintop()); } /// Sets the amount of white space (in pixels) that should appear @@ -659,7 +681,7 @@ public: /// Get the amount of white space (in pixels) that should appear /// below an open child tree's contents. /// - int openchild_marginbottom() const { + int openchild_marginbottom() const { return(_prefs.openchild_marginbottom()); } /// Set the amount of white space (in pixels) that should appear @@ -672,7 +694,7 @@ public: /// Gets the width of the horizontal connection lines (in pixels) /// that appear to the left of each tree item's label. /// - int connectorwidth() const { + int connectorwidth() const { return(_prefs.connectorwidth()); } /// Sets the width of the horizontal connection lines (in pixels) @@ -682,7 +704,8 @@ public: _prefs.connectorwidth(val); redraw(); } - /// Returns the Fl_Image being used as the default user icon for newly created items. + /// Returns the Fl_Image being used as the default user icon for all + /// newly created items. /// Returns zero if no icon has been set, which is the default. /// Fl_Image *usericon() const { -- cgit v1.2.3