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 MINIBUFFER = 8192, //< show when command-execute has been invoked
114 ALLOWAUTO = MATH | TABLE | REVIEW | MATHMACROTEMPLATE | IPA | MINIBUFFER
117 typedef std::vector<ToolbarInfo> Infos;
124 /// iterator for all toolbars
125 Infos::const_iterator begin() const { return toolbar_info_.begin(); }
127 Infos::const_iterator end() const { return toolbar_info_.end(); }
129 Infos::iterator begin() { return toolbar_info_.begin(); }
131 Infos::iterator end() { return toolbar_info_.end(); }
133 /// read toolbars from the file
134 void readToolbars(Lexer &);
136 /// read ui toolbar settings
137 void readToolbarSettings(Lexer &);
140 ToolbarInfo const * info(std::string const & name) const;
142 int defaultVisibility(std::string const & name) const;
144 bool isMainToolbar(std::string const & name) const;
147 /// all the defined toolbars
150 std::map<std::string, int> toolbar_visibility_;
153 } // namespace frontend
156 #endif // TOOLBAR_BACKEND_H