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"
33 /// the command buffer
35 /// adds space between buttons in the toolbar
37 /// a special combox insead of a button
39 /// a special widget to insert tabulars
41 /// a button that expands a menu
43 /// a button that expands a menu but remembers the last choice
49 ToolbarItem(Type type,
50 FuncRequest const & func,
51 docstring const & label = docstring());
53 ToolbarItem(Type type,
54 std::string const & name = std::string(),
55 docstring const & label = docstring());
72 typedef std::vector<ToolbarItem> Items;
74 typedef Items::const_iterator item_iterator;
76 explicit ToolbarInfo(std::string const & name = std::string())
86 /// read a toolbar from the file
87 ToolbarInfo & read(Lexer &);
91 void add(ToolbarItem const &);
98 /// toolbar visibility flags
101 OFF = 2, //< do not show
102 TOP = 4, //< show at top
103 BOTTOM = 8, //< show at bottom
104 LEFT = 16, //< show at left
105 RIGHT = 32, //< show at right
106 AUTO = 64, //< only if AUTO is set, when MATH, TABLE and REVIEW is used
107 MATH = 128, //< show when in math
108 TABLE = 256, //< show when in table
109 REVIEW = 512, //< show when change tracking is enabled
110 MATHMACROTEMPLATE = 1024, //< show in math macro template
111 SAMEROW = 2048 //place to the current row, no new line
114 typedef std::vector<ToolbarInfo> Infos;
121 /// iterator for all toolbars
122 Infos::const_iterator begin() const { return toolbar_info_.begin(); }
124 Infos::const_iterator end() const { return toolbar_info_.end(); }
126 Infos::iterator begin() { return toolbar_info_.begin(); }
128 Infos::iterator end() { return toolbar_info_.end(); }
130 /// read toolbars from the file
131 void readToolbars(Lexer &);
133 /// read ui toolbar settings
134 void readToolbarSettings(Lexer &);
137 ToolbarInfo const * info(std::string const & name) const;
139 int defaultVisibility(std::string const & name) const;
141 bool isMainToolbar(std::string const & name) const;
144 /// all the defined toolbars
147 std::map<std::string, int> toolbar_visibility_;
150 } // namespace frontend
153 #endif // TOOLBAR_BACKEND_H