]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiMenubar.h
the fun begins....
[lyx.git] / src / frontends / qt4 / GuiMenubar.h
1 // -*- C++ -*-
2 /**
3  * \file GuiMenubar.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef GUIMENUBAR_H
14 #define GUIMENUBAR_H
15
16 #include "GuiPopupMenu.h"
17
18 #include <map>
19 #include <boost/scoped_ptr.hpp>
20
21 #include <QObject>
22 #include <QMenuBar>
23
24 namespace lyx {
25
26 class MenuBackend;
27 class Menu;
28 class MenuItem;
29
30 namespace frontend {
31
32 class GuiViewBase;
33 class LyXView;
34
35 class GuiMenubar : public QObject
36 {
37         Q_OBJECT
38 public:
39         GuiMenubar(LyXView *, MenuBackend &);
40
41         /// opens a top-level submenu given its name
42         void openByName(docstring const &);
43
44         /// return the owning view
45         GuiViewBase * view() { return owner_; }
46
47         /// return the menu controller
48         MenuBackend const & backend() { return menubackend_; }
49
50         /// The QMenuBar used by LyX
51         QMenuBar * menuBar() const;
52
53         /// update the state of the menuitems - not needed
54         void updateView();
55
56 private:
57         /// Initialize specific MACOS X menubar
58         void macxMenuBarInit();
59
60         /// owning view
61         GuiViewBase * owner_;
62
63         /// menu controller
64         MenuBackend & menubackend_;
65
66         typedef std::map<docstring, GuiPopupMenu *> NameMap;
67
68         /// name to menu for openByName
69         NameMap name_map_;
70
71         /// MACOS X special menubar.
72         boost::scoped_ptr<QMenuBar> mac_menubar_;
73 };
74
75 } // namespace frontend
76 } // namespace lyx
77
78 #endif // GUIMENUBAR_H