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