2000-08-09 13:51:59 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 2000 The LyX Team.
|
|
|
|
*
|
|
|
|
* ====================================================== */
|
|
|
|
|
|
|
|
#ifndef MENUBAR_PIMPL_H
|
|
|
|
#define MENUBAR_PIMPL_H
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include "LString.h"
|
|
|
|
#include <gnome--/app.h>
|
|
|
|
#include "frontends/Menubar.h"
|
2000-09-19 13:50:47 +00:00
|
|
|
#include "commandtags.h"
|
|
|
|
#include "buffer.h"
|
2000-08-09 13:51:59 +00:00
|
|
|
|
|
|
|
class LyXView;
|
|
|
|
class MenuBackend;
|
|
|
|
class MenuItem;
|
|
|
|
class StrPool;
|
|
|
|
|
2000-09-19 13:50:47 +00:00
|
|
|
#ifdef SIGC_CXX_NAMESPACES
|
|
|
|
using SigC::Connection;
|
|
|
|
#endif
|
|
|
|
|
2000-08-09 13:51:59 +00:00
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
Structure containing Gtk widget and corresponding LyX action
|
|
|
|
*/
|
|
|
|
struct GtkWidgetToAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GtkWidgetToAction(GtkWidget * w, int a) { widget_=w; action_=a; }
|
|
|
|
|
|
|
|
public:
|
|
|
|
GtkWidget * widget_;
|
|
|
|
int action_;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** The LyX GUI independent menubar class
|
|
|
|
The GUI interface is implemented in the corresponding Menubar_pimpl class.
|
|
|
|
*/
|
|
|
|
class Menubar::Pimpl: public SigC::Object {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
Pimpl(LyXView *, MenuBackend const &);
|
|
|
|
///
|
|
|
|
~Pimpl();
|
|
|
|
///
|
|
|
|
void set(string const &);
|
|
|
|
/// Opens a top-level submenu given its name
|
2000-08-17 15:20:30 +00:00
|
|
|
void openByName(string const &);
|
2000-08-09 13:51:59 +00:00
|
|
|
/// update the state of menuitems
|
|
|
|
void update();
|
2000-09-19 13:50:47 +00:00
|
|
|
/// update TOC, LOF, ... on user' request
|
|
|
|
void updateAllLists();
|
2000-08-09 13:51:59 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/// callback function
|
|
|
|
void callback(int action);
|
2000-09-19 13:50:47 +00:00
|
|
|
/// callback function used by lists
|
|
|
|
void callbackToc(Buffer::TocItem tg);
|
2000-08-09 13:51:59 +00:00
|
|
|
/// compose Gnome::UI::Array object describing the menu
|
2000-09-19 13:50:47 +00:00
|
|
|
void composeUIInfo(string const & menu_name, vector<Gnome::UI::Info> & Menus, string path);
|
2000-09-25 11:10:15 +00:00
|
|
|
/// compose Gnome::UI::Array object describing the TOClist
|
|
|
|
vector<Buffer::TocItem>::const_iterator
|
|
|
|
composeTocUIInfo(vector<Gnome::UI::Info> & menu,
|
|
|
|
vector<Buffer::TocItem> const & toclist,
|
|
|
|
vector<Buffer::TocItem>::const_iterator begin,
|
|
|
|
int mylevel);
|
2000-08-09 13:51:59 +00:00
|
|
|
/// populate wid_act_ vector with all widgets and corresponding actions
|
|
|
|
void connectWidgetToAction(GnomeUIInfo * guinfo);
|
2000-09-19 13:50:47 +00:00
|
|
|
|
|
|
|
/// lists (toc, lof, lot, loa)
|
|
|
|
struct ListsHolder {
|
|
|
|
string path;
|
|
|
|
Gnome::UI::Array lst;
|
|
|
|
|
|
|
|
ListsHolder () { }
|
|
|
|
ListsHolder (const ListsHolder & a) { path = a.path; lst = a.lst; }
|
|
|
|
};
|
|
|
|
/// populate lists
|
|
|
|
void updateList(vector<Buffer::TocItem> *, vector<ListsHolder> *);
|
|
|
|
/// Add to "Menus" the list of exportable/viewable formats
|
|
|
|
void add_formats(vector<Gnome::UI::Info> & Menus, kb_action action, bool viewable);
|
2000-08-09 13:51:59 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
LyXView * owner_;
|
|
|
|
///
|
|
|
|
MenuBackend const * menubackend_;
|
|
|
|
///
|
|
|
|
string current_menu_name_;
|
|
|
|
Gnome::UI::Array Menu_;
|
|
|
|
|
|
|
|
///
|
|
|
|
bool ignore_action_;
|
|
|
|
int action_;
|
|
|
|
vector<GtkWidgetToAction> wid_act_;
|
2000-09-19 13:50:47 +00:00
|
|
|
|
|
|
|
/// toc
|
|
|
|
Connection utoc_;
|
|
|
|
vector<ListsHolder> toc_;
|
2000-08-09 13:51:59 +00:00
|
|
|
};
|
|
|
|
#endif
|