]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/Menus.h
Fix the tab ordering of GuiDocument components.
[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                 bool keyboard = false);
40
41         ///
42         ~Menu();
43
44         /// QMenu::clear() reimplementation to handle the deletion of submenus.
45         void clear();
46         
47 private Q_SLOTS:
48         ///
49         void updateView();
50
51 private:
52         friend class Menus;
53
54         /// Use the Pimpl idiom to hide the internals.
55         struct Impl;
56         /// The pointer never changes although *d's contents may.
57         Impl * const d;
58 };
59
60
61 class Menus
62 {
63 public:
64         Menus();
65         ~Menus();
66
67         ///
68         void reset();
69         
70         ///
71         bool searchMenu(FuncRequest const & func,
72                 docstring_list & names) const;
73         ///
74         void fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial = false);
75
76         /// \return a top-level submenu given its name.
77         Menu * menu(QString const & name, GuiView & view, bool keyboard = false);
78
79         ///
80         void read(Lexer &);
81
82         ///
83         void updateMenu(Menu * qmenu);
84
85 private:
86         /// Use the Pimpl idiom to hide the internals.
87         struct Impl;
88         ///
89         Impl * d;
90 };
91
92 } // namespace frontend
93 } // namespace lyx
94
95 #endif // MENUS_H