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
112 IPA = 4096, //< show when in IPA inset
113 ALLOWAUTO = MATH | TABLE | REVIEW | MATHMACROTEMPLATE | IPA
116 typedef std::vector<ToolbarInfo> Infos;
123 /// iterator for all toolbars
124 Infos::const_iterator begin() const { return toolbar_info_.begin(); }
126 Infos::const_iterator end() const { return toolbar_info_.end(); }
128 Infos::iterator begin() { return toolbar_info_.begin(); }
130 Infos::iterator end() { return toolbar_info_.end(); }
132 /// read toolbars from the file
133 void readToolbars(Lexer &);
135 /// read ui toolbar settings
136 void readToolbarSettings(Lexer &);
139 ToolbarInfo const * info(std::string const & name) const;
141 int defaultVisibility(std::string const & name) const;
143 bool isMainToolbar(std::string const & name) const;
146 /// all the defined toolbars
149 std::map<std::string, int> toolbar_visibility_;
152 } // namespace frontend
155 #endif // TOOLBAR_BACKEND_H