]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QLPopupMenu.h
rename LFUN enum values according to their command (as used in th minibuffer/bind...
[lyx.git] / src / frontends / qt4 / QLPopupMenu.h
1 // -*- C++ -*-
2 /**
3  * \file QLPopupMenu.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef QLPOPUPMENU_H
13 #define QLPOPUPMENU_H
14
15 #include <QMenu>
16
17 #include "funcrequest.h"
18 #include "MenuBackend.h"
19
20 #include <utility>
21 #include <string>
22
23 namespace lyx {
24 namespace frontend {
25
26 class QLMenubar;
27
28 /// a submenu
29 class QLPopupMenu : public QMenu {
30         Q_OBJECT
31 public:
32
33         QLPopupMenu(QLMenubar * owner, MenuItem const & mi, bool topLevelMenu=false);
34
35         /// populates the menu or one of its submenu
36         /// This is used as a recursive function
37         void populate(QMenu* qMenu, Menu * menu);
38
39 public slots:
40         /// populate the toplevel menu and all children
41         void update();
42
43 private:
44
45         /// our owning menubar
46         QLMenubar * owner_;
47
48         /// the name of this menu
49         std::string name_;
50
51 private:
52         /// Get a Menu item label from the menu backend
53         std::string const getLabel(MenuItem const & mi);
54
55         /// add binding keys a the menu item label.
56         /// \todo Mac specific binding handling.
57         void addBinding(std::string & label, MenuItem const & mi);
58
59         /// Top Level Menu
60         Menu topLevelMenu_;
61
62         /// Mac specific menu hack
63         /// \todo Fix it
64         void specialMacXmenuHack();
65 };
66
67 } // namespace frontend
68 } // namespace lyx
69
70 #endif // QLPOPUPMENU_H