2003-04-02 18:08:05 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file ToolbarBackend.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author unknown
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TOOLBAR_BACKEND_H
|
|
|
|
#define TOOLBAR_BACKEND_H
|
|
|
|
|
|
|
|
#include <vector>
|
2003-04-08 19:17:00 +00:00
|
|
|
#include <algorithm>
|
2003-04-02 18:08:05 +00:00
|
|
|
|
|
|
|
#include "LString.h"
|
|
|
|
|
|
|
|
class LyXLex;
|
|
|
|
|
|
|
|
///
|
|
|
|
class ToolbarBackend {
|
|
|
|
public:
|
|
|
|
/// The special toolbar actions
|
2003-04-10 14:08:06 +00:00
|
|
|
enum ItemType {
|
2003-04-02 18:08:05 +00:00
|
|
|
/// adds space between buttons in the toolbar
|
|
|
|
SEPARATOR = -3,
|
|
|
|
/// a special combox insead of a button
|
|
|
|
LAYOUTS = -2,
|
|
|
|
/// begin a new line of button (not working)
|
|
|
|
NEWLINE = -1
|
|
|
|
};
|
|
|
|
|
2003-04-08 19:17:00 +00:00
|
|
|
/// action, tooltip
|
|
|
|
typedef std::pair<int, string> Item;
|
|
|
|
|
|
|
|
/// the toolbar items
|
|
|
|
typedef std::vector<std::pair<int, string> > Items;
|
|
|
|
|
2003-04-10 14:08:06 +00:00
|
|
|
/// possibly display types
|
|
|
|
enum DisplayType {
|
|
|
|
OFF, //< never shown
|
|
|
|
ON, //< always shown
|
|
|
|
MATH, //< shown when in math
|
|
|
|
TABLE //< shown when in table
|
|
|
|
};
|
|
|
|
|
2003-04-09 19:53:10 +00:00
|
|
|
/// a toolbar
|
|
|
|
struct Toolbar {
|
|
|
|
/// toolbar UI name
|
|
|
|
string name;
|
|
|
|
/// toolbar contents
|
|
|
|
Items items;
|
2003-04-10 14:08:06 +00:00
|
|
|
/// display type
|
|
|
|
DisplayType display_type;
|
2003-04-09 19:53:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<Toolbar> Toolbars;
|
|
|
|
|
|
|
|
typedef Items::const_iterator item_iterator;
|
2003-04-08 19:17:00 +00:00
|
|
|
|
2003-04-02 18:08:05 +00:00
|
|
|
ToolbarBackend();
|
2003-04-09 19:53:10 +00:00
|
|
|
|
|
|
|
/// iterator for all toolbars
|
|
|
|
Toolbars::const_iterator begin() const {
|
|
|
|
return toolbars.begin();
|
2003-04-02 18:08:05 +00:00
|
|
|
}
|
2003-04-09 19:53:10 +00:00
|
|
|
|
|
|
|
Toolbars::const_iterator end() const {
|
|
|
|
return toolbars.end();
|
2003-04-02 18:08:05 +00:00
|
|
|
}
|
2003-04-09 19:53:10 +00:00
|
|
|
|
|
|
|
/// read a toolbar from the file
|
2003-04-02 18:08:05 +00:00
|
|
|
void read(LyXLex &);
|
2003-04-08 19:17:00 +00:00
|
|
|
|
|
|
|
/// return a full path of an XPM for the given action
|
|
|
|
static string const getIcon(int action);
|
|
|
|
|
2003-04-02 18:08:05 +00:00
|
|
|
private:
|
2003-04-08 19:17:00 +00:00
|
|
|
/// add the given lfun with tooltip if relevant
|
2003-04-09 19:53:10 +00:00
|
|
|
void add(Toolbar & tb, int, string const & tooltip = string());
|
|
|
|
|
2003-04-08 19:17:00 +00:00
|
|
|
/// add the given lfun with tooltip if relevant
|
2003-04-09 19:53:10 +00:00
|
|
|
void add(Toolbar & tb, string const &, string const & tooltip);
|
|
|
|
|
|
|
|
/// all the toolbars
|
|
|
|
Toolbars toolbars;
|
2003-04-02 18:08:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/// The global instance
|
|
|
|
extern ToolbarBackend toolbarbackend;
|
|
|
|
|
|
|
|
|
|
|
|
#endif // TOOLBAR_BACKEND_H
|