]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiPopupMenu.h
fix memory leaks
[lyx.git] / src / frontends / qt4 / GuiPopupMenu.h
1 // -*- C++ -*-
2 /**
3  * \file GuiPopupMenu.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 GUIPOPUPMENU_H
13 #define GUIPOPUPMENU_H
14
15 #include <QMenu>
16
17 #include "FuncRequest.h"
18 #include "MenuBackend.h"
19
20 namespace lyx {
21 namespace frontend {
22
23 class GuiMenubar;
24
25 /// a submenu
26 class GuiPopupMenu : public QMenu
27 {
28         Q_OBJECT
29 public:
30         ///
31         GuiPopupMenu(GuiMenubar * owner, MenuItem const & mi,
32                 bool topLevelMenu = false);
33
34         /// populates the menu or one of its submenu
35         /// This is used as a recursive function
36         void populate(QMenu* qMenu, Menu * menu);
37
38 public Q_SLOTS:
39         /// populate the toplevel menu and all children
40         void updateView();
41
42 private:
43         /// Get a Menu item label from the menu backend
44         docstring const getLabel(MenuItem const & mi);
45         /// add binding keys a the menu item label.
46         void addBinding(docstring & label, MenuItem const & mi);
47
48         /// our owning menubar
49         GuiMenubar * owner_;
50         /// the name of this menu
51         docstring name_;
52         /// Top Level Menu
53         Menu topLevelMenu_;
54 };
55
56 } // namespace frontend
57 } // namespace lyx
58
59 #endif // GUIPOPUPMENU_H