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
45 ToolbarItem(Type type,
46 FuncRequest const & func,
47 docstring const & label = docstring());
49 ToolbarItem(Type type,
50 std::string const & name = std::string(),
51 docstring const & label = docstring());
72 OFF = 2, //< do not show
73 MATH = 4, //< show when in math
74 TABLE = 8, //< show when in table
75 TOP = 16, //< show at top
76 BOTTOM = 32, //< show at bottom
77 LEFT = 64, //< show at left
78 RIGHT = 128, //< show at right
79 REVIEW = 256, //< show when change tracking is enabled
80 AUTO = 512 //< only if AUTO is set, when MATH, TABLE and REVIEW is used
83 typedef std::vector<ToolbarItem> Items;
85 typedef Items::const_iterator item_iterator;
87 explicit ToolbarInfo(std::string const & name = std::string())
99 /// read a toolbar from the file
100 ToolbarInfo & read(Lexer &);
104 void add(ToolbarItem const &);
109 class ToolbarBackend {
111 typedef std::vector<ToolbarInfo> Toolbars;
115 /// iterator for all toolbars
116 Toolbars::const_iterator begin() const { return usedtoolbars.begin(); }
118 Toolbars::const_iterator end() const { return usedtoolbars.end(); }
120 Toolbars::iterator begin() { return usedtoolbars.begin(); }
122 Toolbars::iterator end() { return usedtoolbars.end(); }
124 /// read toolbars from the file
125 void readToolbars(Lexer &);
127 /// read ui toolbar settings
128 void readToolbarSettings(Lexer &);
130 ToolbarInfo const & getToolbar(std::string const & name) const;
132 ToolbarInfo & getToolbar(std::string const & name);
139 Toolbars usedtoolbars;
142 /// The global instance
143 extern ToolbarBackend toolbarbackend;
149 #endif // TOOLBAR_BACKEND_H