FLTK 1.4.0
Loading...
Searching...
No Matches
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 static Fl_Sys_Menu_Bar::window_menu_style_enum window_menu_style() { return window_menu_style_; }
52 static void window_menu_style(Fl_Sys_Menu_Bar::window_menu_style_enum style) { window_menu_style_ = style; }
53};
54
55#endif // !defined(FL_DOXYGEN)
56
57#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
void draw() FL_OVERRIDE
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_-debug-disabled.cxx:503
void mode(int i, int fl)
Sets the flags of item i.
Definition Fl_Menu_.H:157
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_-debug-disabled.cxx:383
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
const Fl_Menu_Item * menu() const
Returns a pointer to the array of Fl_Menu_Items.
Definition Fl_Menu_.H:133
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_-debug-disabled.cxx:588
void shortcut(int i, int s)
Changes the shortcut of item i to s.
Definition Fl_Menu_.H:155
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
window_menu_style_enum
Possible styles of the Window menu in the system menu bar.
Definition Fl_Sys_Menu_Bar.H:101
const char * label() const
Gets the current label text.
Definition Fl_Widget.H:490
unsigned int flags() const
Gets the widget flags mask.
Definition Fl_Widget.H:150
void * user_data() const
Gets the user data for this widget.
Definition Fl_Widget.H:753
The Fl_Menu_Item structure defines a single menu item that is used by the Fl_Menu_ class.
Definition Fl_Menu_Item.H:115