FLTK 1.4.0
Fl_Sys_Menu_Bar.H
Go to the documentation of this file.
1 //
2 // MacOS system menu bar header file for the Fast Light Tool Kit (FLTK).
3 //
4 // Copyright 1998-2017 by Bill Spitzak and others.
5 //
6 // This library is free software. Distribution and use rights are outlined in
7 // the file "COPYING" which should have been included with this file. If this
8 // file is missing or damaged, see the license at:
9 //
10 // https://www.fltk.org/COPYING.php
11 //
12 // Please see the following page on how to report bugs and issues:
13 //
14 // https://www.fltk.org/bugs.php
15 //
16 
22 #ifndef Fl_Sys_Menu_Bar_H
23 #define Fl_Sys_Menu_Bar_H
24 
25 #include <FL/Fl_Menu_Bar.H>
26 
27 class Fl_Sys_Menu_Bar_Driver;
28 
95 class FL_EXPORT Fl_Sys_Menu_Bar : public Fl_Menu_Bar {
96  static Fl_Sys_Menu_Bar_Driver *driver();
97 protected:
98  virtual void draw();
99 public:
101  typedef enum {
102  no_window_menu = 0,
105  tabbing_mode_preferred
106  } window_menu_style_enum;
107  Fl_Sys_Menu_Bar(int x,int y,int w,int h,const char *l=0);
108  virtual ~Fl_Sys_Menu_Bar();
111  const Fl_Menu_Item *menu() const {return Fl_Menu_::menu();}
112  void menu(const Fl_Menu_Item *m);
113  virtual void update();
114  int add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0);
118  int add(const char* label, const char* shortcut, Fl_Callback* cb, void *user_data=0, int flags=0) {
119  return add(label, fl_old_shortcut(shortcut), cb, user_data, flags);
120  }
121  int add(const char* str);
122  int insert(int index, const char* label, int shortcut, Fl_Callback *cb, void *user_data=0, int flags=0);
126  int insert(int index, const char* label, const char* shortcut, Fl_Callback *cb, void *user_data=0, int flags=0) {
127  return insert(index, label, fl_old_shortcut(shortcut), cb, user_data, flags);
128  }
129  void remove(int n);
130  void replace(int index, const char *name);
131  void clear();
132  int clear_submenu(int index);
133  void mode (int i, int fl);
136  int mode(int i) const { return Fl_Menu_::mode(i); }
137  void shortcut (int i, int s);
138  void setonly (Fl_Menu_Item *item);
139  static void about(Fl_Callback *cb, void *data);
140 
141  static window_menu_style_enum window_menu_style();
142  static void window_menu_style(window_menu_style_enum style);
143  static void create_window_menu();
144 };
145 
149 
150 #endif // Fl_Sys_Menu_Bar_H
Fl_Sys_Menu_Bar * fl_sys_menu_bar
The system menu bar.
Definition: Fl_Sys_Menu_Bar.cxx:24
void() Fl_Callback(Fl_Widget *, void *)
Default callback type definition for all fltk widgets (by far the most used)
Definition: Fl_Widget.H:32
This widget provides a standard menubar interface.
Definition: Fl_Menu_Bar.H:65
void draw()
Draws the widget.
Definition: Fl_Menu_Bar.cxx:21
virtual void update()
Updates the menu bar after any change to its items.
Definition: Fl_Menu_Bar.H:93
void replace(int, const char *)
Changes the text of item i.
Definition: Fl_Menu_add.cxx:472
void clear()
Same as menu(NULL), set the array pointer to null, indicating a zero-length menu.
Definition: Fl_Menu_.cxx:455
void mode(int i, int fl)
Sets the flags of item i.
Definition: Fl_Menu_.H:153
const Fl_Menu_Item * menu() const
Returns a pointer to the array of Fl_Menu_Items.
Definition: Fl_Menu_.H:129
void setonly(Fl_Menu_Item *item)
Turns the radio item "on" for the menu item and turns "off" adjacent radio items of the same group.
Definition: Fl_Menu_.cxx:342
int insert(int index, const char *, int shortcut, Fl_Callback *, void *=0, int=0)
Inserts a new menu item at the specified index position.
Definition: Fl_Menu_add.cxx:384
void remove(int)
Deletes item i from the menu.
Definition: Fl_Menu_add.cxx:492
int clear_submenu(int index)
Clears the specified submenu pointed to by index of all menu items.
Definition: Fl_Menu_.cxx:499
void shortcut(int i, int s)
Changes the shortcut of item i to s.
Definition: Fl_Menu_.H:151
int add(const char *, int shortcut, Fl_Callback *, void *=0, int=0)
Adds a new menu item.
Definition: Fl_Menu_add.cxx:348
A class to create and modify menus that appear on macOS in the menu bar at the top of the screen.
Definition: Fl_Sys_Menu_Bar.H:95
int mode(int i) const
Gets the flags of item i.
Definition: Fl_Sys_Menu_Bar.H:136
@ tabbing_mode_automatic
Windows are created by themselves but can be tabbed later.
Definition: Fl_Sys_Menu_Bar.H:104
@ tabbing_mode_none
No tabbed windows, but the system menu bar contains a Window menu.
Definition: Fl_Sys_Menu_Bar.H:103
int insert(int index, const char *label, const char *shortcut, Fl_Callback *cb, void *user_data=0, int flags=0)
Insert a new menu item.
Definition: Fl_Sys_Menu_Bar.H:126
int add(const char *label, const char *shortcut, Fl_Callback *cb, void *user_data=0, int flags=0)
Adds a new menu item.
Definition: Fl_Sys_Menu_Bar.H:118
const Fl_Menu_Item * menu() const
Return the system menu's array of Fl_Menu_Item's.
Definition: Fl_Sys_Menu_Bar.H:111
FL_EXPORT unsigned int fl_old_shortcut(const char *s)
Emulation of XForms named shortcuts.
Definition: fl_shortcut.cxx:274
The Fl_Menu_Item structure defines a single menu item that is used by the Fl_Menu_ class.
Definition: Fl_Menu_Item.H:114