2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiPopupMenu.h
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUIPOPUPMENU_H
|
|
|
|
#define GUIPOPUPMENU_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
#include <QMenu>
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "FuncRequest.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "MenuBackend.h"
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
class GuiMenubar;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
/// a submenu
|
2007-08-31 22:16:11 +00:00
|
|
|
class GuiPopupMenu : public QMenu
|
|
|
|
{
|
2006-03-05 17:24:44 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-08-31 22:16:11 +00:00
|
|
|
///
|
|
|
|
GuiPopupMenu(GuiMenubar * owner, MenuItem const & mi,
|
|
|
|
bool topLevelMenu = false);
|
2006-04-05 23:56:29 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
/// populates the menu or one of its submenu
|
|
|
|
/// This is used as a recursive function
|
|
|
|
void populate(QMenu* qMenu, Menu * menu);
|
|
|
|
|
2006-06-30 14:37:33 +00:00
|
|
|
public Q_SLOTS:
|
2006-03-05 17:24:44 +00:00
|
|
|
/// populate the toplevel menu and all children
|
2007-09-03 20:28:26 +00:00
|
|
|
void updateView();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2006-04-05 23:56:29 +00:00
|
|
|
private:
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Get a Menu item label from the menu backend
|
2007-04-25 16:39:21 +00:00
|
|
|
docstring const getLabel(MenuItem const & mi);
|
2006-03-05 17:24:44 +00:00
|
|
|
/// add binding keys a the menu item label.
|
2007-04-25 16:39:21 +00:00
|
|
|
void addBinding(docstring & label, MenuItem const & mi);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
/// our owning menubar
|
|
|
|
GuiMenubar * owner_;
|
|
|
|
/// the name of this menu
|
|
|
|
docstring name_;
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Top Level Menu
|
2006-03-15 11:27:32 +00:00
|
|
|
Menu topLevelMenu_;
|
2006-03-05 17:24:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUIPOPUPMENU_H
|