Added is_visible_r() for consistency w/is_visible()

This commit is contained in:
Greg Ercolano 2024-07-17 10:20:39 -07:00
parent 741d58757b
commit f950b93e9c
2 changed files with 12 additions and 3 deletions

View File

@ -392,7 +392,16 @@ public:
int is_visible() const { int is_visible() const {
return(is_flag(VISIBLE)); return(is_flag(VISIBLE));
} }
int visible_r() const; /// See if item and all its parents are open() and visible().
/// Alias for is_visible_r().
/// \returns
/// 1 -- item and its parents are open() and visible()
/// 0 -- item (or one of its parents) are not visible or close()ed.
///
int visible_r() const {
return(is_visible_r());
}
int is_visible_r() const;
/// Set the item's user icon to an Fl_Image. Use '0' to disable. /// Set the item's user icon to an Fl_Image. Use '0' to disable.
/// No internal copy is made, caller must manage icon's memory. /// No internal copy is made, caller must manage icon's memory.

View File

@ -1433,9 +1433,9 @@ Fl_Tree_Item *Fl_Tree_Item::prev_displayed(Fl_Tree_Prefs &prefs) {
/// See if item and all its parents are open() and visible(). /// See if item and all its parents are open() and visible().
/// \returns /// \returns
/// 1 -- item and its parents are open() and visible() /// 1 -- item and its parents are open() and visible()
/// 0 -- item (or one of its parents) are invisible or close()ed. /// 0 -- item or one of its parents are either not visible() or close()ed.
/// ///
int Fl_Tree_Item::visible_r() const { int Fl_Tree_Item::is_visible_r() const {
if ( !visible() ) return(0); if ( !visible() ) return(0);
for (const Fl_Tree_Item *p=parent(); p; p=p->parent())// move up through parents for (const Fl_Tree_Item *p=parent(); p; p=p->parent())// move up through parents
if (!p->visible() || p->is_close()) return(0); // any parent not visible or closed? if (!p->visible() || p->is_close()) return(0); // any parent not visible or closed?