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