From 759794dbdb8f479b81d9f3b72da9099199433f2f Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Thu, 8 Dec 2011 17:10:11 +0000 Subject: 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 --- FL/Fl_Menu_.H | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/FL/Fl_Menu_.H b/FL/Fl_Menu_.H index 8df408ef4..d39b751bc 100644 --- a/FL/Fl_Menu_.H +++ b/FL/Fl_Menu_.H @@ -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; tsize(); 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); -- cgit v1.2.3