mod/maxgui.mod/fltkmaxgui.mod/src/Fl_Menu_.cxx
int Fl_Menu_::clear_submenu(int index) {
  if ( index < 0 || index >= size() ) return(-1);
  if ( ! (menu_[index].flags & FL_SUBMENU) ) return(-1);
  ++index;					// advance to first item in submenu
  while ( index < size() ) {                    // keep remove()ing top item until end is reached
    if ( menu_[index].text == 0 ) break;	// end of this submenu? done
    remove(index);				// remove items/submenus
  }
  return(0);
}
/**
 Clears the specified submenu pointed to by \p index of all menu items.

 This method is useful for clearing a submenu so that it can be
 re-populated with new items. Example: a "File/Recent Files/..." submenu
 that shows the last few files that have been opened.

 The specified \p index must point to a submenu.
 
 The submenu is cleared with remove().
 If the menu array was directly set with menu(x), then copy() 
 is done to make a private array.

 \warning Since this method can change the internal menu array, any menu
 item pointers or indecies the application may have cached can become
 stale, and should be recalculated/refreshed.

 \b Example:
 \code
   int index = menubar->find_index("File/Recent");    // get index of "File/Recent" submenu
   if ( index != -1 ) menubar->clear_submenu(index);  // clear the submenu
   menubar->add("File/Recent/Aaa");
   menubar->add("File/Recent/Bbb");
   [..]
 \endcode

 \param index The index of the submenu to be cleared
 \returns 0 on success, -1 if the index is out of range or not a submenu
 \see remove(int)
 */
Clears the specified submenu pointed to by \p index of all menu items.
This method is useful for clearing a submenu so that it can be
re-populated with new items. Example: a "File/Recent Files/..." submenu
that shows the last few files that have been opened.

The specified \p index must point to a submenu.

The submenu is cleared with remove().
If the menu array was directly set with menu(x), then copy()
is done to make a private array.

\warning Since this method can change the internal menu array, any menu
item pointers or indecies the application may have cached can become
stale, and should be recalculated/refreshed.



\param index The index of the submenu to be cleared
\returns 0 on success, -1 if the index is out of range or not a submenu
\see remove(int)
Clears the specified submenu pointed to by \ p index of all menu items . This method is useful for clearing a submenu so that it can be re - populated with new items . Example : a " File / Recent Files / ... " submenu that shows the last few files that have been opened . The specified \ p index must point to a submenu . The submenu is cleared with remove () . If the menu array was directly set with menu ( x ) then copy () is done to make a private array . \ warning Since this method can change the internal menu array any menu item pointers or indecies the application may have cached can become stale and should be recalculated / refreshed . \ param index The index of the submenu to be cleared \ returns 0 on success - 1 if the index is out of range or not a submenu \ see remove ( int )
int Fl_Menu_::clear_submenu(int index) {
  if ( index < 0 || index >= size() ) return(-1);
  if ( ! (menu_[index].flags & FL_SUBMENU) ) return(-1);
  ++index;					
  while ( index < size() ) {                    
    if ( menu_[index].text == 0 ) break;	
    remove(index);				
  }
  return(0);
}
int Fl_Menu_ :: clear_submenu ( int index ) { if ( index < 0 || index >= size ( ) ) return ( -1 ) ; if ( ! ( menu_ [ index ] . flags & FL_SUBMENU ) ) return ( -1 ) ; ++ index ; while ( index < size ( ) ) { if ( menu_ [ index ] . text == 0 ) break ; remove ( index ) ; } return ( 0 ) ; }
Clears the specified submenu pointed to by \p index of all menu items.
Clears the specified submenu pointed to by \ p index of all menu items .
// advance to first item in submenu // keep remove()ing top item until end is reached // end of this submenu? done // remove items/submenus