FLTK 1.3.0
Fl_Sys_Menu_Bar Class Reference

A class to create, modify and delete menus that appear on Mac OS X in the menu bar at the top of the screen. More...

#include <Fl_Sys_Menu_Bar.H>

Inheritance diagram for Fl_Sys_Menu_Bar:
Fl_Menu_Bar Fl_Menu_ Fl_Widget

List of all members.

Public Member Functions

int add (const char *label, int shortcut, Fl_Callback *, void *user_data=0, int flags=0)
 add to the system menu bar a new menu item
void clear ()
 Same as menu(NULL), set the array pointer to null, indicating a zero-length menu.
int clear_submenu (int index)
 Clears the specified submenu pointed to by index of all menu items.
 Fl_Sys_Menu_Bar (int x, int y, int w, int h, const char *l=0)
 The constructor.
int insert (int index, const char *label, int shortcut, Fl_Callback *cb, void *user_data=0, int flags=0)
 insert in the system menu bar a new menu item
void menu (const Fl_Menu_Item *m)
 create a system menu bar using the given list of menu structs
void remove (int n)
 remove an item from the system menu bar
void replace (int rank, const char *name)
 rename an item from the system menu bar

Protected Member Functions

void draw ()
 Draws the widget.

Detailed Description

A class to create, modify and delete menus that appear on Mac OS X in the menu bar at the top of the screen.

On other than Mac OS X platforms, Fl_Sys_Menu_Bar is a synonym of class Fl_Menu_Bar.


Constructor & Destructor Documentation

Fl_Sys_Menu_Bar::Fl_Sys_Menu_Bar ( int  x,
int  y,
int  w,
int  h,
const char *  l = 0 
) [inline]

The constructor.

On Mac OS X, all arguments are unused. On other platforms they are used as by Fl_Menu_Bar::Fl_Menu_Bar().


Member Function Documentation

int Fl_Sys_Menu_Bar::add ( const char *  label,
int  shortcut,
Fl_Callback cb,
void *  user_data = 0,
int  flags = 0 
)

add to the system menu bar a new menu item

add to the system menu bar a new menu item, with a title string, shortcut int, callback, argument to the callback, and flags.

See also:
Fl_Menu_::add(const char* label, int shortcut, Fl_Callback *cb, void *user_data, int flags)

Reimplemented from Fl_Menu_.

void Fl_Sys_Menu_Bar::clear ( )

Same as menu(NULL), set the array pointer to null, indicating a zero-length menu.

Menus must not be cleared during a callback to the same menu.

Reimplemented from Fl_Menu_.

int Fl_Sys_Menu_Bar::clear_submenu ( int  index)

Clears the specified submenu pointed to by 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 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.

Example:

   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");
   [..]
Parameters:
indexThe index of the submenu to be cleared
Returns:
0 on success, -1 if the index is out of range or not a submenu
See also:
remove(int)

Reimplemented from Fl_Menu_.

void Fl_Sys_Menu_Bar::draw ( ) [protected, virtual]

Draws the widget.

Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead.

Override this function to draw your own widgets.

If you ever need to call another widget's draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:

        Fl_Widget *s = &scroll;         // scroll is an embedded Fl_Scrollbar
        s->draw();                      // calls Fl_Scrollbar::draw()

Reimplemented from Fl_Menu_Bar.

int Fl_Sys_Menu_Bar::insert ( int  index,
const char *  label,
int  shortcut,
Fl_Callback cb,
void *  user_data = 0,
int  flags = 0 
)

insert in the system menu bar a new menu item

insert in the system menu bar a new menu item, with a title string, shortcut int, callback, argument to the callback, and flags.

See also:
Fl_Menu_::insert(int index, const char* label, int shortcut, Fl_Callback *cb, void *user_data, int flags)

Reimplemented from Fl_Menu_.

void Fl_Sys_Menu_Bar::menu ( const Fl_Menu_Item m)

create a system menu bar using the given list of menu structs

Author:
Matthias Melcher
Parameters:
mlist of Fl_Menu_Item

Reimplemented from Fl_Menu_.

void Fl_Sys_Menu_Bar::remove ( int  rank)

remove an item from the system menu bar

Parameters:
rankthe rank of the item to remove

Reimplemented from Fl_Menu_.

void Fl_Sys_Menu_Bar::replace ( int  rank,
const char *  name 
)

rename an item from the system menu bar

Parameters:
rankthe rank of the item to rename
namethe new item name as a UTF8 string

Reimplemented from Fl_Menu_.


The documentation for this class was generated from the following files: