diff options
| author | Greg Ercolano <erco@seriss.com> | 2011-12-08 17:10:11 +0000 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2011-12-08 17:10:11 +0000 |
| commit | 759794dbdb8f479b81d9f3b72da9099199433f2f (patch) | |
| tree | adf15c53bf2428a6c8c8966d92146f56b73a1205 /FL | |
| parent | 367f5633340b8ea99f2be86c3f8bd2cf80c29947 (diff) | |
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
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_Menu_.H | 14 |
1 files changed, 14 insertions, 0 deletions
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; 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); |
