mod/maxgui.mod/fltkmaxgui.mod/src/Fl_Tree_Item.cxx
Fl_Tree_Item *Fl_Tree_Item::next_displayed(Fl_Tree_Prefs &prefs) {
  Fl_Tree_Item *c = this;
  while ( c ) {
    if ( c->is_root() && !prefs.showroot() ) {		// on root and can't show it?
      c = c->next();					// skip ahead, try again
      continue;
    }
    if ( c->has_children() && c->is_close() ) {		// item has children and: invisible or closed?
      // Skip children, take next sibling. If none, try parent's sibling, repeat
      while ( c ) {
	Fl_Tree_Item *sib = c->next_sibling();		// get sibling
	if ( sib ) { c = sib; break; }			// Found? let outer loop test it
	c = c->parent();				// No sibling? move up tree, try parent's sibling
      }
    } else {						// has children and isn't closed, or no children
      c = c->next();					// use normal 'next'
    }
    if ( !c ) return(0);				// no more? done
    // Check all parents to be sure none are closed.
    // If closed, move up to that level and repeat until sure none are closed.
    Fl_Tree_Item *p = c->parent();
    while (1) {
      if ( !p || p->is_root() ) return(c);		// hit top? then we're displayed, return c
      if ( p->is_close() ) c = p;			// found closed parent? make it current
      p = p->parent();					// continue up tree
    }
    if ( c && c->visible() ) return(c);			// item visible? return it
  }
  return(0);						// hit end: no more items
}
/// Return the next visible item. (If this item has children and is closed, children are skipped)
///
/// This method can be used to walk the tree forward, skipping items
/// that are not currently visible to the user.
/// 
/// \returns the next visible item below us, or 0 if there's no more items.
///
Return the next visible item. (If this item has children and is closed, children are skipped)
This method can be used to walk the tree forward, skipping items
that are not currently visible to the user.

\returns the next visible item below us, or 0 if there's no more items.
Return the next visible item . ( If this item has children and is closed children are skipped ) This method can be used to walk the tree forward skipping items that are not currently visible to the user . \ returns the next visible item below us or 0 if there ' s no more items .
Fl_Tree_Item *Fl_Tree_Item::next_displayed(Fl_Tree_Prefs &prefs) {
  Fl_Tree_Item *c = this;
  while ( c ) {
    if ( c->is_root() && !prefs.showroot() ) {		
      c = c->next();					
      continue;
    }
    if ( c->has_children() && c->is_close() ) {		
      while ( c ) {
	Fl_Tree_Item *sib = c->next_sibling();		
	if ( sib ) { c = sib; break; }			
	c = c->parent();				
      }
    } else {						
      c = c->next();					
    }
    if ( !c ) return(0);				
    Fl_Tree_Item *p = c->parent();
    while (1) {
      if ( !p || p->is_root() ) return(c);		
      if ( p->is_close() ) c = p;			
      p = p->parent();					
    }
    if ( c && c->visible() ) return(c);			
  }
  return(0);						
}
Fl_Tree_Item * Fl_Tree_Item :: next_displayed ( Fl_Tree_Prefs & prefs ) { Fl_Tree_Item * c = this ; while ( c ) { if ( c -> is_root ( ) && ! prefs . showroot ( ) ) { c = c -> next ( ) ; continue ; } if ( c -> has_children ( ) && c -> is_close ( ) ) { while ( c ) { Fl_Tree_Item * sib = c -> next_sibling ( ) ; if ( sib ) { c = sib ; break ; } c = c -> parent ( ) ; } } else { c = c -> next ( ) ; } if ( ! c ) return ( 0 ) ; Fl_Tree_Item * p = c -> parent ( ) ; while ( 1 ) { if ( ! p || p -> is_root ( ) ) return ( c ) ; if ( p -> is_close ( ) ) c = p ; p = p -> parent ( ) ; } if ( c && c -> visible ( ) ) return ( c ) ; } return ( 0 ) ; }
Return the next visible item.
Return the next visible item .
// on root and can't show it? // skip ahead, try again // item has children and: invisible or closed? // Skip children, take next sibling. If none, try parent's sibling, repeat // get sibling // Found? let outer loop test it // No sibling? move up tree, try parent's sibling // has children and isn't closed, or no children // use normal 'next' // no more? done // Check all parents to be sure none are closed. // If closed, move up to that level and repeat until sure none are closed. // hit top? then we're displayed, return c // found closed parent? make it current // continue up tree // item visible? return it // hit end: no more items