diff options
| author | Greg Ercolano <erco@seriss.com> | 2015-04-28 19:39:53 +0000 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2015-04-28 19:39:53 +0000 |
| commit | 81654d15ebabd1f4f62df70ddb1de05d6860b5a4 (patch) | |
| tree | d1600be93fcb3457ab8d7e606f05a16b8d2d117f /FL | |
| parent | e4f645d60f6cc6197674f913bd52b4032c91aa45 (diff) | |
Fl_Tree: improved draw() behavior when deactivated;
icons draw deactivated now.
test/tree: Added 'deactivate tree' button to test
deactivating entire widget.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10723 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_Tree_Item.H | 20 | ||||
| -rw-r--r-- | FL/Fl_Tree_Prefs.H | 36 |
2 files changed, 56 insertions, 0 deletions
diff --git a/FL/Fl_Tree_Item.H b/FL/Fl_Tree_Item.H index 23ce1d543..72bf619b0 100644 --- a/FL/Fl_Tree_Item.H +++ b/FL/Fl_Tree_Item.H @@ -100,6 +100,9 @@ class FL_EXPORT Fl_Tree_Item { int _label_xywh[4]; // xywh of label Fl_Widget *_widget; // item's label widget (optional) Fl_Image *_usericon; // item's user-specific icon (optional) +#if FLTK_ABI_VERSION >= 10304 + Fl_Image *_userdeicon; // deactivated usericon +#endif Fl_Tree_Item_Array _children; // array of child items Fl_Tree_Item *_parent; // parent item (=0 if root) void *_userdata; // user data that can be associated with an item @@ -425,12 +428,29 @@ public: /// Set the item's user icon to an Fl_Image. '0' will disable. void usericon(Fl_Image *val) { _usericon = val; +#if FLTK_ABI_VERSION >= 10304 + // Update deactivated version of icon.. + if ( _userdeicon ) delete _userdeicon; + if ( _usericon ) { + _userdeicon = _usericon->copy(); + _userdeicon->inactive(); + } else { + _userdeicon = 0; + } +#endif recalc_tree(); // may change tree geometry } /// Get the item's user icon as an Fl_Image. Returns '0' if disabled. Fl_Image *usericon() const { return(_usericon); } +#if FLTK_ABI_VERSION >= 10304 + /// Return the deactivated version of the user icon, if any. + /// Returns 0 if none. + Fl_Image* userdeicon() const { + return _userdeicon; + } +#endif ////////////////// // Events ////////////////// diff --git a/FL/Fl_Tree_Prefs.H b/FL/Fl_Tree_Prefs.H index ba6e7b0d0..7c080a310 100644 --- a/FL/Fl_Tree_Prefs.H +++ b/FL/Fl_Tree_Prefs.H @@ -132,6 +132,11 @@ class FL_EXPORT Fl_Tree_Prefs { Fl_Image *_openimage; // the 'open' icon [+] Fl_Image *_closeimage; // the 'close' icon [-] Fl_Image *_userimage; // user's own icon +#if FLTK_ABI_VERSION >= 10304 + Fl_Image *_opendeimage; // deactivated 'open' icon + Fl_Image *_closedeimage; // deactivated 'close' icon + Fl_Image *_userdeimage; // deactivated user icon +#endif char _showcollapse; // 1=show collapse icons, 0=don't char _showroot; // show the root item as part of the tree Fl_Tree_Sort _sortorder; // none, ascening, descending, etc. @@ -147,6 +152,9 @@ class FL_EXPORT Fl_Tree_Prefs { #endif public: Fl_Tree_Prefs(); +#if FLTK_ABI_VERSION >= 10304 + ~Fl_Tree_Prefs(); +#endif //////////////////////////// // Labels @@ -340,7 +348,35 @@ public: /// inline void usericon(Fl_Image *val) { _userimage = val; +#if FLTK_ABI_VERSION >= 10304 + // Update deactivated version of icon.. + if ( _userdeimage ) delete _userdeimage; + if ( _userimage ) { + _userdeimage = _userimage->copy(); + _userdeimage->inactive(); + } else { + _userdeimage = 0; + } +#endif } + +#if FLTK_ABI_VERSION >= 10304 + /// Return the deactivated version of the open icon, if any. + /// Returns 0 if none. + inline Fl_Image *opendeicon() const { + return _opendeimage; + } + /// Return the deactivated version of the close icon, if any. + /// Returns 0 if none. + inline Fl_Image *closedeicon() const { + return _closedeimage; + } + /// Return the deactivated version of the user icon, if any. + /// Returns 0 if none. + inline Fl_Image *userdeicon() const { + return _userdeimage; + } +#endif //////////////////////////// // Options |
