]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/Menus.h
Small Menu code reorg:
[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 "support/docstring.h"
17
18 #include <QMenu>
19
20 #include <vector>
21
22 class QString;
23
24 namespace lyx {
25
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         ~Menu();
41
42 private Q_SLOTS:
43         ///
44         void updateView();
45
46 private:
47         friend class Menus;
48
49         /// Use the Pimpl idiom to hide the internals.
50         struct Impl;
51         /// The pointer never changes although *d's contents may.
52         Impl * const d;
53 };
54
55
56 class Menus
57 {
58 public:
59         Menus();
60         
61         ///
62         bool searchMenu(FuncRequest const & func,
63                 std::vector<docstring> & names) const;
64         ///
65         void fillMenuBar(GuiView * view);
66
67         /// \return a top-level submenu given its name.
68         Menu * menu(QString const & name, GuiView & view);
69
70         ///
71         void read(Lexer &);
72
73         ///
74         void updateMenu(QString const & name);
75
76 private:
77         /// Use the Pimpl idiom to hide the internals.
78         struct Impl;
79         /// The pointer never changes although *d's contents may.
80         Impl * const d;
81 };
82
83 } // namespace frontend
84 } // namespace lyx
85
86 #endif // MENUS_H