2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-12-26 10:55:43 +00:00
|
|
|
* \file Menus.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.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2006-03-05 17:24:44 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-12-26 10:55:43 +00:00
|
|
|
#ifndef MENUS_H
|
|
|
|
#define MENUS_H
|
|
|
|
|
2008-03-09 15:14:59 +00:00
|
|
|
#include <QMenu>
|
2008-03-09 14:20:16 +00:00
|
|
|
|
2008-03-07 00:21:23 +00:00
|
|
|
#include <vector>
|
2007-12-26 13:29:45 +00:00
|
|
|
|
2008-03-08 15:33:52 +00:00
|
|
|
class QString;
|
2008-03-14 19:51:42 +00:00
|
|
|
class QMenuBar;
|
2007-12-26 13:29:45 +00:00
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
namespace lyx {
|
2008-03-07 00:21:23 +00:00
|
|
|
|
2008-05-24 10:15:52 +00:00
|
|
|
class docstring_list;
|
2008-03-07 00:21:23 +00:00
|
|
|
class Lexer;
|
2008-03-08 15:33:52 +00:00
|
|
|
class FuncRequest;
|
2008-03-07 00:21:23 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace frontend {
|
|
|
|
|
2007-11-05 13:52:37 +00:00
|
|
|
class GuiView;
|
2008-03-07 00:21:23 +00:00
|
|
|
|
2008-03-09 20:38:03 +00:00
|
|
|
class Menu : public QMenu
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
///
|
2011-02-15 16:53:37 +00:00
|
|
|
Menu(GuiView * gv, QString const & name, bool top_level,
|
|
|
|
bool keyboard = false);
|
2008-03-09 20:38:03 +00:00
|
|
|
|
2008-03-14 15:34:31 +00:00
|
|
|
///
|
2008-03-09 20:38:03 +00:00
|
|
|
~Menu();
|
2011-07-14 11:10:13 +00:00
|
|
|
|
|
|
|
/// QMenu::clear() reimplementation to handle the deletion of submenus.
|
|
|
|
void clear();
|
2011-12-03 22:15:11 +00:00
|
|
|
|
2008-03-09 20:38:03 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
///
|
|
|
|
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.
|
|
|
|
Impl * const d;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-07 00:21:23 +00:00
|
|
|
class Menus
|
2007-09-05 20:33:29 +00:00
|
|
|
{
|
2006-03-05 17:24:44 +00:00
|
|
|
public:
|
2008-03-08 15:33:52 +00:00
|
|
|
Menus();
|
2008-04-16 19:43:06 +00:00
|
|
|
~Menus();
|
2008-06-25 18:03:38 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
void reset();
|
2011-12-03 22:15:11 +00:00
|
|
|
|
2008-03-07 00:21:23 +00:00
|
|
|
///
|
2008-03-08 15:33:52 +00:00
|
|
|
bool searchMenu(FuncRequest const & func,
|
2008-05-24 10:15:52 +00:00
|
|
|
docstring_list & names) const;
|
2007-11-21 21:14:34 +00:00
|
|
|
///
|
2008-03-15 02:58:05 +00:00
|
|
|
void fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial = false);
|
2007-11-21 21:14:34 +00:00
|
|
|
|
2007-12-26 12:40:58 +00:00
|
|
|
/// \return a top-level submenu given its name.
|
2011-02-15 16:53:37 +00:00
|
|
|
Menu * menu(QString const & name, GuiView & view, bool keyboard = false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2008-03-07 00:21:23 +00:00
|
|
|
///
|
|
|
|
void read(Lexer &);
|
|
|
|
|
|
|
|
///
|
2008-03-14 15:34:31 +00:00
|
|
|
void updateMenu(Menu * qmenu);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
private:
|
2008-03-08 15:33:52 +00:00
|
|
|
/// Use the Pimpl idiom to hide the internals.
|
|
|
|
struct Impl;
|
2008-06-25 18:03:38 +00:00
|
|
|
///
|
|
|
|
Impl * d;
|
2006-03-05 17:24:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-12-26 10:55:43 +00:00
|
|
|
#endif // MENUS_H
|