1 //
2 // "$Id$"
3 //
4 // Menu bar header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2016 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file.  If this
10 // file is missing or damaged, see the license at:
11 //
12 //     http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 //     http://www.fltk.org/str.php
17 //
18 
19 /* \file
20    Fl_Menu_Bar widget . */
21 
22 #ifndef Fl_Menu_Bar_H
23 #define Fl_Menu_Bar_H
24 
25 #include "Fl_Menu_.H"
26 
27 /**
28   This widget provides a standard menubar interface.  Usually you will
29   put this widget along the top edge of your window.  The height of the
30   widget should be 30 for the menu titles to draw correctly with the
31   default font.
32 
33   The items on the bar and the menus they bring up are defined by a
34   single Fl_Menu_Item array.
35   Because a Fl_Menu_Item array defines a hierarchy, the
36   top level menu defines the items in the menubar, while the submenus
37   define the pull-down menus. Sub-sub menus and lower pop up to the right
38   of the submenus.
39 
40   \image html  menubar.png
41   \image latex  menubar.png " menubar" width=12cm
42 
43   If there is an item in the top menu that is not a title of a
44   submenu, then it acts like a "button" in the menubar.  Clicking on it
45   will pick it.
46 
47   When the user clicks a menu item, value() is set to that item
48   and then:
49 
50     - The item's callback is done if one has been set; the
51       Fl_Menu_Bar is passed as the Fl_Widget* argument,
52       along with any userdata configured for the callback.
53 
54     - If the item does not have a callback, the Fl_Menu_Bar's callback
55       is done instead, along with any userdata configured for the callback.
56       The callback can determine which item was picked using
57       value(), mvalue(), item_pathname(), etc.
58 
59   Submenus will also pop up in response to shortcuts indicated by
60   putting a '&' character in the name field of the menu item. If you put a
61   '&' character in a top-level "button" then the shortcut picks it.  The
62   '&' character in submenus is ignored until the menu is popped up.
63 
64   Typing the shortcut() of any of the menu items will cause
65   callbacks exactly the same as when you pick the item with the mouse.
66 */
67 class FL_EXPORT Fl_Menu_Bar : public Fl_Menu_ {
68 protected:
69     void draw();
70 public:
71     int handle(int);
72   /**
73     Creates a new Fl_Menu_Bar widget using the given position,
74     size, and label string. The default boxtype is FL_UP_BOX.
75 
76     The constructor sets menu() to NULL.  See
77     Fl_Menu_ for the methods to set or change the menu.
78 
79     labelsize(), labelfont(), and labelcolor()
80     are used to control how the menubar items are drawn.  They are
81     initialized from the Fl_Menu static variables, but you can
82     change them if desired.
83 
84     label() is ignored unless you change align() to
85     put it outside the menubar.
86 
87     The destructor removes the Fl_Menu_Bar widget and all of its
88     menu items.
89   */
90   Fl_Menu_Bar(int X, int Y, int W, int H, const char *l=0);
91 };
92 
93 #endif
94 
95 //
96 // End of "$Id$".
97 //
98