2002-09-24 13:57:09 +00:00
|
|
|
// -*- C++ -*-
|
2002-08-25 18:26:45 +00:00
|
|
|
/**
|
|
|
|
* \file QLPopupMenu.h
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-08-25 18:26:45 +00:00
|
|
|
*
|
2002-09-24 13:57:09 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-08-25 18:26:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QLPOPUPMENU_H
|
|
|
|
#define QLPOPUPMENU_H
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
|
|
#include <qpopupmenu.h>
|
2002-08-25 18:26:45 +00:00
|
|
|
|
2003-09-21 18:57:15 +00:00
|
|
|
#include "funcrequest.h"
|
|
|
|
|
|
|
|
#include <vector>
|
2003-09-08 16:23:31 +00:00
|
|
|
#include <utility>
|
2003-07-29 09:55:48 +00:00
|
|
|
|
2002-08-25 18:26:45 +00:00
|
|
|
class MenuBackend;
|
|
|
|
class MenuItem;
|
2002-09-10 19:23:38 +00:00
|
|
|
class Menu;
|
2002-08-25 18:26:45 +00:00
|
|
|
class QMenuData;
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2003-07-25 21:34:45 +00:00
|
|
|
class QLMenubar;
|
2002-09-10 19:23:38 +00:00
|
|
|
class QLPopupMenu;
|
2002-08-25 18:26:45 +00:00
|
|
|
|
|
|
|
/// create a sub-menu
|
2002-09-10 19:23:38 +00:00
|
|
|
std::pair<int, QLPopupMenu *>
|
2002-10-20 01:48:28 +00:00
|
|
|
createMenu(QMenuData * parent, MenuItem const * item,
|
2003-07-25 21:34:45 +00:00
|
|
|
QLMenubar * owner, bool is_toplevel = false);
|
2002-09-24 13:57:09 +00:00
|
|
|
|
2002-08-25 18:26:45 +00:00
|
|
|
/// a submenu
|
|
|
|
class QLPopupMenu : public QPopupMenu {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2003-07-25 21:34:45 +00:00
|
|
|
QLPopupMenu(QLMenubar * owner,
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & name, bool toplevel);
|
2002-09-10 19:23:38 +00:00
|
|
|
|
2002-09-24 13:57:09 +00:00
|
|
|
/// populate the menu
|
2002-09-10 19:23:38 +00:00
|
|
|
void populate(Menu * menu);
|
2002-08-25 18:26:45 +00:00
|
|
|
public slots:
|
2002-09-10 19:23:38 +00:00
|
|
|
/// populate the toplevel menu and all children
|
2002-08-25 18:26:45 +00:00
|
|
|
void showing();
|
2003-09-21 18:57:15 +00:00
|
|
|
///
|
|
|
|
void fire(int);
|
2002-08-25 18:26:45 +00:00
|
|
|
private:
|
|
|
|
/// our owning menubar
|
2003-07-25 21:34:45 +00:00
|
|
|
QLMenubar * owner_;
|
2002-08-25 18:26:45 +00:00
|
|
|
|
|
|
|
/// the name of this menu
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string name_;
|
2003-09-21 18:57:15 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
typedef std::vector<FuncRequest> Funcs;
|
|
|
|
///
|
|
|
|
Funcs funcs_;
|
2002-08-25 18:26:45 +00:00
|
|
|
};
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2002-08-25 18:26:45 +00:00
|
|
|
#endif // QLPOPUPMENU_H
|