]> git.lyx.org Git - features.git/blob - src/frontends/qt4/QLMenubar.h
9f94c944dba616e691cc90612e6203cd86cc43b3
[features.git] / src / frontends / qt4 / QLMenubar.h
1 // -*- C++ -*-
2 /**
3  * \file qt4/QLMenubar.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 QLMENUBAR_H
14 #define QLMENUBAR_H
15
16 #include "frontends/Menubar.h"
17
18 #include "QLPopupMenu.h"
19
20 #include <map>
21 #include <boost/scoped_ptr.hpp>
22
23 #include <QObject>
24 #include <QMenuBar>
25
26 namespace lyx {
27
28 class MenuBackend;
29 class Menu;
30 class MenuItem;
31
32 namespace frontend {
33
34 class GuiView;
35 class LyXView;
36
37 class QLMenubar : public QObject, public Menubar {
38         Q_OBJECT
39 public:
40         QLMenubar(LyXView *, MenuBackend &);
41
42         /// opens a top-level submenu given its name
43         void openByName(docstring const &);
44
45         /// return the owning view
46         GuiView * view();
47
48         /// return the menu controller
49         MenuBackend const & backend();
50
51         /// The QMenuBar used by LyX
52         QMenuBar * menuBar() const;
53
54         /// update the state of the menuitems - not needed
55         void update();
56
57 public Q_SLOTS:
58         /// populate a toplevel menu and all its children on demand
59 //      void updateMenu();
60
61 private:
62         /// Initialize specific MACOS X menubar
63         void macxMenuBarInit();
64
65         /// owning view
66         GuiView * owner_;
67
68         /// menu controller
69         MenuBackend & menubackend_;
70
71         typedef std::map<docstring, QLPopupMenu *> NameMap;
72
73         /// name to menu for openByName
74         NameMap name_map_;
75
76         /// MACOS X special menubar.
77         boost::scoped_ptr<QMenuBar> mac_menubar_;
78 };
79
80 } // namespace frontend
81 } // namespace lyx
82
83 #endif // QLMENUBAR_H