]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/Menus.h
Introduce docstring_list
[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         bool searchMenu(FuncRequest const & func,
65                 docstring_list & names) const;
66         ///
67         void fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial = false);
68
69         /// \return a top-level submenu given its name.
70         Menu * menu(QString const & name, GuiView & view);
71
72         ///
73         void read(Lexer &);
74
75         ///
76         void updateMenu(Menu * qmenu);
77
78 private:
79         /// Use the Pimpl idiom to hide the internals.
80         struct Impl;
81         /// The pointer never changes although *d's contents may.
82         Impl * const d;
83 };
84
85 } // namespace frontend
86 } // namespace lyx
87
88 #endif // MENUS_H