]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiMenubar.h
Introducing GuiMenubar::init() to avoid destructing the object in order to re-initial...
[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 <QObject>
17 #include <QHash>
18
19 class QMenuBar;
20
21 namespace lyx {
22
23 class MenuBackend;
24
25 namespace frontend {
26
27 class GuiView;
28 class GuiPopupMenu;
29 class LyXView;
30
31 class GuiMenubar : public QObject
32 {
33         Q_OBJECT
34 public:
35         GuiMenubar(LyXView *, MenuBackend &);
36
37         ~GuiMenubar();
38
39         ///
40         void init();
41
42         /// opens a top-level submenu given its name
43         void openByName(QString const & name);
44
45         /// return the owning view
46         GuiView * view() { return owner_; }
47
48         /// return the menu controller
49         MenuBackend const & backend() { return menubackend_; }
50
51         /// The QMenuBar used by LyX
52         QMenuBar * menuBar() const;
53
54         /// update the state of the menuitems - not needed
55         void updateView();
56
57 private:
58         /// Initialize specific MACOS X menubar
59         void macxMenuBarInit();
60
61         /// owning view
62         GuiView * owner_;
63
64         /// menu controller
65         MenuBackend & menubackend_;
66
67         typedef QHash<QString, GuiPopupMenu *> NameMap;
68
69         /// name to menu for openByName
70         NameMap name_map_;
71
72         /// MACOS X special menubar.
73         QMenuBar * mac_menubar_;
74 };
75
76 } // namespace frontend
77 } // namespace lyx
78
79 #endif // GUIMENUBAR_H