Author: greg.ercolano
Date: 2011-12-08 09:10:11 -0800 (Thu, 08 Dec 2011)
New Revision: 9202
Log:
Added docs to show how to walk the menu array.


Modified:
   branches/branch-1.3/FL/Fl_Menu_.H

Modified: branches/branch-1.3/FL/Fl_Menu_.H
===================================================================
--- branches/branch-1.3/FL/Fl_Menu_.H   2011-12-08 09:58:51 UTC (rev 9201)
+++ branches/branch-1.3/FL/Fl_Menu_.H   2011-12-08 17:10:11 UTC (rev 9202)
@@ -78,6 +78,20 @@
   /**
     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);

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to