2000-07-24 13:53:19 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-03-11 17:00:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file Menubar_pimpl.h
|
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
|
* Copyright 1995-2002 the LyX Team
|
|
|
|
|
* Copyright 1996-2001 Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* Read the file COPYING
|
2000-07-24 13:53:19 +00:00
|
|
|
|
*
|
2002-03-11 17:00:41 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes, larsbj@lyx.org
|
|
|
|
|
*/
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
|
|
|
|
#ifndef MENUBAR_PIMPL_H
|
|
|
|
|
#define MENUBAR_PIMPL_H
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "LString.h"
|
|
|
|
|
#include "frontends/Menubar.h"
|
2000-08-30 03:40:51 +00:00
|
|
|
|
#include "commandtags.h"
|
2001-05-09 15:20:58 +00:00
|
|
|
|
#include "MenuBackend.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
|
|
2002-05-22 01:16:37 +00:00
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
|
|
|
|
|
#include FORMS_H_LOCATION
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <map>
|
|
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
|
class LyXView;
|
|
|
|
|
|
|
|
|
|
/** The LyX GUI independent menubar class
|
2002-03-21 21:21:28 +00:00
|
|
|
|
The GUI interface is implemented in the corresponding Menubar_pimpl class.
|
2000-07-24 13:53:19 +00:00
|
|
|
|
*/
|
|
|
|
|
struct Menubar::Pimpl {
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
Pimpl(LyXView *, MenuBackend const &);
|
|
|
|
|
///
|
|
|
|
|
void set(string const &);
|
|
|
|
|
/// Opens a top-level submenu given its name
|
|
|
|
|
void openByName(string const &);
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
static void MenuCallback(FL_OBJECT *, long);
|
|
|
|
|
|
|
|
|
|
///
|
2000-08-31 11:51:59 +00:00
|
|
|
|
void add_toc(int menu, string const & extra_label,
|
|
|
|
|
std::vector<int> & smn, Window win);
|
|
|
|
|
///
|
|
|
|
|
void add_references(int menu, string const & extra_label,
|
|
|
|
|
std::vector<int> & smn, Window win);
|
|
|
|
|
///
|
|
|
|
|
int create_submenu(Window win, LyXView * view,
|
2002-03-21 21:21:28 +00:00
|
|
|
|
string const & menuname,
|
|
|
|
|
std::vector<int> & smn);
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
/// update the state of the menuitems
|
|
|
|
|
void update() {}
|
2000-07-24 13:53:19 +00:00
|
|
|
|
private:
|
2000-09-26 16:16:55 +00:00
|
|
|
|
//
|
|
|
|
|
void makeMenubar(Menu const &menu);
|
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
///
|
2000-07-24 13:53:19 +00:00
|
|
|
|
LyXView * owner_;
|
|
|
|
|
///
|
|
|
|
|
MenuBackend const * menubackend_;
|
|
|
|
|
///
|
|
|
|
|
struct ItemInfo {
|
|
|
|
|
///
|
2002-03-21 21:21:28 +00:00
|
|
|
|
ItemInfo(Menubar::Pimpl * p, MenuItem const * i,
|
2001-03-07 16:18:05 +00:00
|
|
|
|
FL_OBJECT * o)
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-03-07 16:18:05 +00:00
|
|
|
|
: pimpl_(p), obj_(o) { item_.reset(i); }
|
2000-07-24 13:53:19 +00:00
|
|
|
|
///
|
|
|
|
|
Menubar::Pimpl * pimpl_;
|
|
|
|
|
///
|
2001-03-07 16:18:05 +00:00
|
|
|
|
boost::shared_ptr<MenuItem const> item_;
|
2000-07-24 13:53:19 +00:00
|
|
|
|
///
|
|
|
|
|
FL_OBJECT * obj_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
///
|
2001-03-07 16:18:05 +00:00
|
|
|
|
typedef std::vector<boost::shared_ptr<ItemInfo> > ButtonList;
|
2000-07-24 13:53:19 +00:00
|
|
|
|
///
|
|
|
|
|
ButtonList buttonlist_;
|
2000-09-26 16:16:55 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
typedef std::map<string, FL_OBJECT *> MenubarMap;
|
|
|
|
|
///
|
|
|
|
|
MenubarMap menubarmap_;
|
|
|
|
|
///
|
|
|
|
|
string current_menu_name_;
|
|
|
|
|
///
|
|
|
|
|
FL_OBJECT * current_group_;
|
2000-07-24 13:53:19 +00:00
|
|
|
|
};
|
|
|
|
|
#endif
|