]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QLPopupMenu.h
Transfer Text::drawSelection() from InsetText::drawSelection() to InsetText::draw...
[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 namespace lyx {
21 namespace frontend {
22
23 class QLMenubar;
24
25 /// a submenu
26 class QLPopupMenu : public QMenu {
27         Q_OBJECT
28 public:
29
30         QLPopupMenu(QLMenubar * owner, MenuItem const & mi, bool topLevelMenu=false);
31
32         /// populates the menu or one of its submenu
33         /// This is used as a recursive function
34         void populate(QMenu* qMenu, Menu * menu);
35
36 public Q_SLOTS:
37         /// populate the toplevel menu and all children
38         void update();
39
40 private:
41
42         /// our owning menubar
43         QLMenubar * owner_;
44
45         /// the name of this menu
46         docstring name_;
47
48 private:
49         /// Get a Menu item label from the menu backend
50         docstring const getLabel(MenuItem const & mi);
51
52         /// add binding keys a the menu item label.
53         void addBinding(docstring & label, MenuItem const & mi);
54
55         /// Top Level Menu
56         Menu topLevelMenu_;
57 };
58
59 } // namespace frontend
60 } // namespace lyx
61
62 #endif // QLPOPUPMENU_H