\end_document replaces \the_end.
[lyx.git] / src / ToolbarBackend.h
blob9a84eee9bc0b6a97cf48b1fc485025453bfbd37a
1 // -*- C++ -*-
2 /**
3 * \file ToolbarBackend.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author unknown
9 * Full author contact details are available in file CREDITS
12 #ifndef TOOLBAR_BACKEND_H
13 #define TOOLBAR_BACKEND_H
15 #include <vector>
16 #include <algorithm>
18 #include "LString.h"
20 class LyXLex;
22 ///
23 class ToolbarBackend {
24 public:
25 /// The special toolbar actions
26 enum ItemType {
27 /// the command buffer
28 MINIBUFFER = -3,
29 /// adds space between buttons in the toolbar
30 SEPARATOR = -2,
31 /// a special combox insead of a button
32 LAYOUTS = -1,
35 /// action, tooltip
36 typedef std::pair<int, string> Item;
38 /// the toolbar items
39 typedef std::vector<std::pair<int, string> > Items;
41 /// toolbar flags
42 enum Flags {
43 ON = 1, //< always shown
44 OFF = 2, //< never shown
45 MATH = 4, //< shown when in math
46 TABLE = 8, //< shown when in table
47 TOP = 16, //< show at top
48 BOTTOM = 32, //< show at bottom
49 LEFT = 64, //< show at left
50 RIGHT = 128 //< show at right
53 /// a toolbar
54 struct Toolbar {
55 /// toolbar UI name
56 string name;
57 /// toolbar contents
58 Items items;
59 /// flags
60 Flags flags;
63 typedef std::vector<Toolbar> Toolbars;
65 typedef Items::const_iterator item_iterator;
67 ToolbarBackend();
69 /// iterator for all toolbars
70 Toolbars::const_iterator begin() const {
71 return usedtoolbars.begin();
74 Toolbars::const_iterator end() const {
75 return usedtoolbars.end();
78 /// read a toolbar from the file
79 void read(LyXLex &);
81 /// read the used toolbars
82 void readToolbars(LyXLex &);
84 /// return a full path of an XPM for the given action
85 static string const getIcon(int action);
87 private:
88 /// add the given lfun with tooltip if relevant
89 void add(Toolbar & tb, int, string const & tooltip = string());
91 /// add the given lfun with tooltip if relevant
92 void add(Toolbar & tb, string const &, string const & tooltip);
94 /// all the toolbars
95 Toolbars toolbars;
97 /// toolbars listed
98 Toolbars usedtoolbars;
101 /// The global instance
102 extern ToolbarBackend toolbarbackend;
105 #endif // TOOLBAR_BACKEND_H