Added docs to show how to walk the menu array.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9202 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Greg Ercolano 2011-12-08 17:10:11 +00:00
parent 367f563334
commit 759794dbdb

View File

@ -78,6 +78,20 @@ public:
/**
Returns a pointer to the array of Fl_Menu_Items. This will either be
the value passed to menu(value) or the private copy.
\sa size() -- returns the size of the Fl_Menu_Item array.
\b Example: How to walk the array:
\code
for ( int t=0; t<menubar->size(); t++ ) { // walk array of items
const Fl_Menu_Item &item = menubar->menu()[t]; // get each item
fprintf(stderr, "item #%d -- label=%s, value=%s type=%s\n",
t,
item.label() ? item.label() : "(Null)", // menu terminators have NULL labels
(item.flags & FL_MENU_VALUE) ? "set" : "clear", // value of toggle or radio items
(item.flags & FL_SUBMENU) ? "Submenu" : "Item"); // see if item is a submenu or actual item
}
\endcode
*/
const Fl_Menu_Item *menu() const {return menu_;}
void menu(const Fl_Menu_Item *m);