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 Jean-Marc Lasgouttes
10 * Full author contact details are available in file CREDITS.
13 #ifndef TOOLBAR_BACKEND_H
14 #define TOOLBAR_BACKEND_H
16 #include "funcrequest.h"
31 /// the command buffer
33 /// adds space between buttons in the toolbar
35 /// a special combox insead of a button
37 /// a special widget to insert tabulars
41 ToolbarItem(Type type,
42 FuncRequest const & func,
43 docstring const & label = docstring());
45 ToolbarItem(Type type,
46 std::string const & name = std::string(),
47 docstring const & label = docstring());
68 OFF = 2, //< do not show
69 MATH = 4, //< show when in math
70 TABLE = 8, //< show when in table
71 TOP = 16, //< show at top
72 BOTTOM = 32, //< show at bottom
73 LEFT = 64, //< show at left
74 RIGHT = 128, //< show at right
75 REVIEW = 256, //< show when change tracking is enabled
76 AUTO = 512 //< only if AUTO is set, when MATH, TABLE and REVIEW is used
79 typedef std::vector<ToolbarItem> Items;
81 typedef Items::const_iterator item_iterator;
83 explicit ToolbarInfo(std::string const & name = std::string())
95 /// read a toolbar from the file
96 ToolbarInfo & read(LyXLex &);
100 void add(ToolbarItem const &);
105 class ToolbarBackend {
107 typedef std::vector<ToolbarInfo> Toolbars;
111 /// iterator for all toolbars
112 Toolbars::const_iterator begin() const { return usedtoolbars.begin(); }
114 Toolbars::const_iterator end() const { return usedtoolbars.end(); }
116 Toolbars::iterator begin() { return usedtoolbars.begin(); }
118 Toolbars::iterator end() { return usedtoolbars.end(); }
120 /// read toolbars from the file
121 void readToolbars(LyXLex &);
123 /// read ui toolbar settings
124 void readToolbarSettings(LyXLex &);
126 ToolbarInfo const & getToolbar(std::string const & name) const;
128 ToolbarInfo & getToolbar(std::string const & name);
135 Toolbars usedtoolbars;
138 /// The global instance
139 extern ToolbarBackend toolbarbackend;
145 #endif // TOOLBAR_BACKEND_H