* 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 "MenuBackend.h"
+#include <QMenu>
-#include <QObject>
-#include <QHash>
+class QString;
+class QMenuBar;
namespace lyx {
+
+class docstring_list;
+class Lexer;
+class FuncRequest;
+
namespace frontend {
-class GuiView;
-class GuiPopupMenu;
class GuiView;
-class Menus : public QObject, public MenuBackend
+class Menu : public QMenu
{
Q_OBJECT
public:
- Menus() {}
+ ///
+ Menu(GuiView * gv, QString const & name, bool top_level,
+ bool keyboard = false);
///
- void fillMenuBar(GuiView * view);
+ ~Menu();
- /// opens a top-level submenu given its name
- void openByName(QString const & name);
+ /// QMenu::clear() reimplementation to handle the deletion of submenus.
+ void clear();
- /// update the state of the menuitems - not needed
+private Q_SLOTS:
+ ///
void updateView();
private:
- /// Initialize specific MACOS X menubar
- void macxMenuBarInit(GuiView * view);
+ friend class Menus;
+
+ /// Use the Pimpl idiom to hide the internals.
+ struct Impl;
+ /// The pointer never changes although *d's contents may.
+ Impl * const d;
+};
+
+
+class Menus
+{
+public:
+ Menus();
+ ~Menus();
- typedef QHash<QString, GuiPopupMenu *> NameMap;
+ ///
+ 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);
- /// name to menu for openByName
- NameMap name_map_;
+ ///
+ void read(Lexer &);
+
+ ///
+ void updateMenu(Menu * qmenu);
+
+private:
+ /// Use the Pimpl idiom to hide the internals.
+ struct Impl;
+ ///
+ Impl * d;
};
} // namespace frontend