FLTK 1.4.3
Fl_Sys_Menu_Bar_Driver.H
1//
2// system menu bar widget 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
17#ifndef Fl_Sys_Menu_Bar_Driver_H
18#define Fl_Sys_Menu_Bar_Driver_H
19
20#if !defined(FL_DOXYGEN)
21
22#include <FL/Fl_Sys_Menu_Bar.H>
23
24class Fl_Sys_Menu_Bar_Driver {
25 friend class Fl_Sys_Menu_Bar;
26public:
27 static Fl_Sys_Menu_Bar::window_menu_style_enum window_menu_style_;
28 static Fl_Sys_Menu_Bar_Driver *driver_; // to be assigned with a unique object of this class or of a derived class
29 Fl_Sys_Menu_Bar *bar;
30 Fl_Sys_Menu_Bar_Driver();
31 virtual ~Fl_Sys_Menu_Bar_Driver();
32 virtual void update() {}
33 virtual void draw() { bar->Fl_Menu_Bar::draw();}
34 virtual void about(Fl_Callback *, void *) {}
35 virtual int add(const char* label, int shortcut, Fl_Callback *cb, void *user_data, int flags) {
36 return bar->Fl_Menu_Bar::add(label, shortcut, cb, user_data, flags);
37 }
38 virtual int add(const char* str) { return bar->Fl_Menu_Bar::add(str); }
39 virtual int insert(int index, const char* label, int shortcut, Fl_Callback *cb, void *user_data, int flags) {
40 return bar->Fl_Menu_Bar::insert(index, label, shortcut, cb, user_data, flags);
41 }
42 virtual void menu(const Fl_Menu_Item *m) { bar->Fl_Menu_Bar::menu(m); }
43 virtual void shortcut(int i, int s) { bar->Fl_Menu_Bar::shortcut(i, s); }
44 virtual void setonly(Fl_Menu_Item *item) { bar->Fl_Menu_Bar::setonly(item); }
45 virtual void clear() { bar->Fl_Menu_Bar::clear(); }
46 virtual int clear_submenu(int index) { return bar->Fl_Menu_Bar::clear_submenu(index);}
47 virtual void remove(int index) { bar->Fl_Menu_Bar::remove(index); }
48 virtual void replace(int index, const char *name) { bar->Fl_Menu_Bar::replace(index, name); }
49 virtual void mode(int i, int fl) { bar->Fl_Menu_Bar::mode(i, fl); }
50 virtual void create_window_menu() {}
51 virtual void play_menu(const Fl_Menu_Item *) {}
52 static Fl_Sys_Menu_Bar::window_menu_style_enum window_menu_style() { return window_menu_style_; }
53 static void window_menu_style(Fl_Sys_Menu_Bar::window_menu_style_enum style) { window_menu_style_ = style; }
54};
55
56#endif // !defined(FL_DOXYGEN)
57
58#endif // Fl_Sys_Menu_Bar_Driver_H
Definition of class Fl_Sys_Menu_Bar.
void() Fl_Callback(Fl_Widget *, void *)
Default callback type definition for all fltk widgets (by far the most used)
Definition: Fl_Widget.H:33
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 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
Definition: Fl_Sys_Menu_Bar.cxx:133
void clear()
Set the Fl_Menu_Item array pointer to null, indicating a zero-length menu.
Definition: Fl_Sys_Menu_Bar.cxx:142
static window_menu_style_enum window_menu_style()
Get the style of the Window menu in the system menu bar.
Definition: Fl_Sys_Menu_Bar.cxx:201
void mode(int i, int fl)
Sets the flags of item i.
Definition: Fl_Sys_Menu_Bar.cxx:86
void update() FL_OVERRIDE
Updates the menu bar after any change to its items.
Definition: Fl_Sys_Menu_Bar.cxx:53
void replace(int index, const char *name)
rename an item from the system menu bar
Definition: Fl_Sys_Menu_Bar.cxx:173
window_menu_style_enum
Possible styles of the Window menu in the system menu bar.
Definition: Fl_Sys_Menu_Bar.H:101
void shortcut(int i, int s)
Changes the shortcut of item i to n.
Definition: Fl_Sys_Menu_Bar.cxx:72
static void create_window_menu()
Adds a Window menu, to the end of the system menu bar.
Definition: Fl_Sys_Menu_Bar.cxx:238
void draw() FL_OVERRIDE
Draws the widget.
Definition: Fl_Sys_Menu_Bar.cxx:193
void remove(int n)
remove an item from the system menu bar
Definition: Fl_Sys_Menu_Bar.cxx:161
int add(const char *label, int shortcut, Fl_Callback *, void *user_data=0, int flags=0)
Add a new menu item to the system menu bar.
Definition: Fl_Sys_Menu_Bar.cxx:107
static void about(Fl_Callback *cb, void *data)
Attaches a callback to the "About myprog" item of the system application menu.
Definition: Fl_Sys_Menu_Bar.cxx:186
const Fl_Menu_Item * menu() const
Return the system menu's array of Fl_Menu_Item's.
Definition: Fl_Sys_Menu_Bar.H:111
int clear_submenu(int index)
Clears the specified submenu pointed to by index of all menu items.
Definition: Fl_Sys_Menu_Bar.cxx:151
void play_menu(const Fl_Menu_Item *) FL_OVERRIDE
Opens the 1st level submenu of the menubar corresponding to item.
Definition: Fl_Sys_Menu_Bar.cxx:245
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_Sys_Menu_Bar.cxx:78
const char * label() const
Gets the current label text.
Definition: Fl_Widget.H:498
unsigned int flags() const
Gets the widget flags mask.
Definition: Fl_Widget.H:158
void * user_data() const
Gets the user data for this widget.
Definition: Fl_Widget.H:792
The Fl_Menu_Item structure defines a single menu item that is used by the Fl_Menu_ class.
Definition: Fl_Menu_Item.H:124