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.
|
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \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-08 15:33:52 +00:00
|
|
|
|
#include "support/docstring.h"
|
2008-03-07 00:21:23 +00:00
|
|
|
|
|
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;
|
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
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
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-03-07 00:21:23 +00:00
|
|
|
|
///
|
2008-03-08 15:33:52 +00:00
|
|
|
|
bool searchMenu(FuncRequest const & func,
|
|
|
|
|
std::vector<docstring> & names) const;
|
2007-11-21 21:14:34 +00:00
|
|
|
|
///
|
2007-12-26 10:55:43 +00:00
|
|
|
|
void fillMenuBar(GuiView * view);
|
2007-11-21 21:14:34 +00:00
|
|
|
|
|
2007-12-26 12:40:58 +00:00
|
|
|
|
/// \return a top-level submenu given its name.
|
2008-03-09 11:22:39 +00:00
|
|
|
|
QMenu * menu(QString const & name, GuiView & view);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2008-03-07 00:21:23 +00:00
|
|
|
|
///
|
|
|
|
|
void read(Lexer &);
|
|
|
|
|
|
|
|
|
|
///
|
2008-03-08 15:33:52 +00:00
|
|
|
|
void updateMenu(QString const & name);
|
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;
|
|
|
|
|
/// The pointer never changes although *d's contents may.
|
|
|
|
|
Impl * const d;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
};
|
|
|
|
|
|
2008-03-09 14:20:16 +00:00
|
|
|
|
|
|
|
|
|
class GuiPopupMenuBase : public QMenu
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
GuiPopupMenuBase(QWidget * parent = 0)
|
|
|
|
|
: QMenu(parent)
|
|
|
|
|
{
|
|
|
|
|
connect(this, SIGNAL(aboutToShow()), this, SLOT(updateView()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
|
///
|
|
|
|
|
virtual void updateView() = 0;
|
|
|
|
|
};
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2007-12-26 10:55:43 +00:00
|
|
|
|
#endif // MENUS_H
|