]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/Menus.h
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / Menus.h
1 // -*- C++ -*-
2 /**
3  * \file Menus.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 MENUS_H
14 #define MENUS_H
15
16 #include <QMenu>
17
18 #include <vector>
19
20 class QString;
21 class QMenuBar;
22
23 namespace lyx {
24
25 class docstring_list;
26 class Lexer;
27 class FuncRequest;
28
29 namespace frontend {
30
31 class GuiView;
32
33 class Menu : public QMenu
34 {
35         Q_OBJECT
36 public:
37         ///
38         Menu(GuiView * gv, QString const & name, bool top_level);
39
40         ///
41         ~Menu();
42         
43 private Q_SLOTS:
44         ///
45         void updateView();
46
47 private:
48         friend class Menus;
49
50         /// Use the Pimpl idiom to hide the internals.
51         struct Impl;
52         /// The pointer never changes although *d's contents may.
53         Impl * const d;
54 };
55
56
57 class Menus
58 {
59 public:
60         Menus();
61         ~Menus();
62
63         ///
64         void reset();
65         
66         ///
67         bool searchMenu(FuncRequest const & func,
68                 docstring_list & names) const;
69         ///
70         void fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial = false);
71
72         /// \return a top-level submenu given its name.
73         Menu * menu(QString const & name, GuiView & view);
74
75         ///
76         void read(Lexer &);
77
78         ///
79         void updateMenu(Menu * qmenu);
80
81 private:
82         /// Use the Pimpl idiom to hide the internals.
83         struct Impl;
84         ///
85         Impl * d;
86 };
87
88 } // namespace frontend
89 } // namespace lyx
90
91 #endif // MENUS_H