]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/Menus.h
* mac menus do not handle showEvent, only the aboutToShow signal.
[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 Menus
34 {
35 public:
36         Menus();
37         
38         ///
39         bool searchMenu(FuncRequest const & func,
40                 std::vector<docstring> & names) const;
41         ///
42         void fillMenuBar(GuiView * view);
43
44         /// \return a top-level submenu given its name.
45         QMenu * menu(QString const & name, GuiView & view);
46
47         ///
48         void read(Lexer &);
49
50         ///
51         void updateMenu(QString const & name);
52
53 private:
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 GuiPopupMenuBase : public QMenu
62 {
63         Q_OBJECT
64         
65 public:
66         ///
67         GuiPopupMenuBase(QWidget * parent = 0)
68                 : QMenu(parent)
69         {
70                 connect(this, SIGNAL(aboutToShow()), this, SLOT(updateView()));
71         }
72         
73 private Q_SLOTS:
74         ///
75         virtual void updateView() = 0;
76 };
77
78 } // namespace frontend
79 } // namespace lyx
80
81 #endif // MENUS_H