* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
* \author John Levon
*
* Full author contact details are available in file CREDITS.
#ifndef MENUS_H
#define MENUS_H
-#include "support/docstring.h"
-
#include <QMenu>
-#include <vector>
-
class QString;
+class QMenuBar;
namespace lyx {
+class docstring_list;
class Lexer;
class FuncRequest;
class GuiView;
-class Menus
+class Menu : public QMenu
{
+ Q_OBJECT
public:
- Menus();
-
///
- bool searchMenu(FuncRequest const & func,
- std::vector<docstring> & names) const;
- ///
- void fillMenuBar(GuiView * view);
-
- /// \return a top-level submenu given its name.
- QMenu * menu(QString const & name, GuiView & view);
+ Menu(GuiView * gv, QString const & name, bool top_level,
+ bool keyboard = false);
///
- void read(Lexer &);
+ ~Menu();
+
+ /// QMenu::clear() reimplementation to handle the deletion of submenus.
+ void clear();
+private Q_SLOTS:
///
- void updateMenu(QString const & name);
+ void updateView();
private:
+ friend class Menus;
+
/// Use the Pimpl idiom to hide the internals.
struct Impl;
/// The pointer never changes although *d's contents may.
};
-class GuiPopupMenuBase : public QMenu
+class Menus
{
- Q_OBJECT
-
public:
+ Menus();
+ ~Menus();
+
///
- GuiPopupMenuBase(QWidget * parent = 0)
- : QMenu(parent)
- {
- connect(this, SIGNAL(aboutToShow()), this, SLOT(updateView()));
- }
-
-private Q_SLOTS:
+ void reset();
+
+ ///
+ bool searchMenu(FuncRequest const & func,
+ docstring_list & names) const;
+ ///
+ void fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial = false);
+
+ /// \return a top-level submenu given its name.
+ Menu * menu(QString const & name, GuiView & view, bool keyboard = false);
+
+ ///
+ void read(Lexer &);
+
+ ///
+ void updateMenu(Menu * qmenu);
+
+private:
+ /// Use the Pimpl idiom to hide the internals.
+ struct Impl;
///
- virtual void updateView() = 0;
+ Impl * d;
};
} // namespace frontend