blob: 5e522f6ad5b3fda6adb9fca9ccee9b4756fb85cd [file] [log] [blame]
DRC2ff39b82011-07-28 08:38:59 +00001//
2// "$Id: Fl_Menu_Bar.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
3//
4// Menu bar header file for the Fast Light Tool Kit (FLTK).
5//
6// Copyright 1998-2010 by Bill Spitzak and others.
7//
8// This library is free software; you can redistribute it and/or
9// modify it under the terms of the GNU Library General Public
10// License as published by the Free Software Foundation; either
11// version 2 of the License, or (at your option) any later version.
12//
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16// Library General Public License for more details.
17//
18// You should have received a copy of the GNU Library General Public
19// License along with this library; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21// USA.
22//
23// Please report all bugs and problems on the following page:
24//
25// http://www.fltk.org/str.php
26//
27
28/* \file
29 Fl_Menu_Bar widget . */
30
31#ifndef Fl_Menu_Bar_H
32#define Fl_Menu_Bar_H
33
34#include "Fl_Menu_.H"
35
36/**
37 This widget provides a standard menubar interface. Usually you will
38 put this widget along the top edge of your window. The height of the
39 widget should be 30 for the menu titles to draw correctly with the
40 default font.
41 <P>The items on the bar and the menus they bring up are defined by a
42 single Fl_Menu_Item
43 array. Because a Fl_Menu_Item array defines a hierarchy, the
44 top level menu defines the items in the menubar, while the submenus
45 define the pull-down menus. Sub-sub menus and lower pop up to the right
46 of the submenus. </P>
47 <P ALIGN=CENTER>\image html menubar.png</P>
48 \image latex menubar.png " menubar" width=12cm
49 <P>If there is an item in the top menu that is not a title of a
50 submenu, then it acts like a "button" in the menubar. Clicking on it
51 will pick it. </P>
52 <P>When the user picks an item off the menu, the item's callback is
53 done with the menubar as the Fl_Widget* argument. If the item
54 does not have a callback the menubar's callback is done instead. </P>
55 <P>Submenus will also pop up in response to shortcuts indicated by
56 putting a '&' character in the name field of the menu item. If you put a
57 '&' character in a top-level "button" then the shortcut picks it. The
58 '&' character in submenus is ignored until the menu is popped up. </P>
59 <P>Typing the shortcut() of any of the menu items will cause
60 callbacks exactly the same as when you pick the item with the mouse.
61*/
62class FL_EXPORT Fl_Menu_Bar : public Fl_Menu_ {
63protected:
64 void draw();
65public:
66 int handle(int);
67 /**
68 Creates a new Fl_Menu_Bar widget using the given position,
69 size, and label string. The default boxtype is FL_UP_BOX.
70 <P>The constructor sets menu() to NULL. See
71 Fl_Menu_ for the methods to set or change the menu. </P>
72 <P>labelsize(), labelfont(), and labelcolor()
73 are used to control how the menubar items are drawn. They are
74 initialized from the Fl_Menu static variables, but you can
75 change them if desired. </P>
76 <P>label() is ignored unless you change align() to
77 put it outside the menubar.
78 <P>The destructor removes the Fl_Menu_Bar widget and all of its
79 menu items.
80 */
81 Fl_Menu_Bar(int X, int Y, int W, int H,const char *l=0)
82 : Fl_Menu_(X,Y,W,H,l) {}
83};
84
85#endif
86
87//
88// End of "$Id: Fl_Menu_Bar.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
89//