]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/Menus.h
Fix faulty undo recording
[lyx.git] / src / frontends / qt / 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 BufferView;
24 class docstring_list;
25 class FuncRequest;
26
27 namespace support { class Lexer; }
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         /// noncopyable
64         Menus(Menus const &);
65         void operator=(Menus const &);
66 public:
67         Menus();
68         ~Menus();
69
70         ///
71         void reset();
72
73         ///
74         bool searchMenu(FuncRequest const & func,
75                 docstring_list & names, BufferView const * bv = 0) const;
76         ///
77         void fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial = false);
78
79         /// \return a top-level submenu given its name.
80         Menu * menu(QString const & name, GuiView & view, bool keyboard = false);
81
82         ///
83         void read(support::Lexer &);
84
85         ///
86         void updateMenu(Menu * qmenu);
87
88 private:
89         /// Use the Pimpl idiom to hide the internals.
90         struct Impl;
91         ///
92         Impl * d;
93 };
94
95 } // namespace frontend
96 } // namespace lyx
97
98 #endif // MENUS_H