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 "support/docstring.h"
27 namespace support { class Lexer; }
34 /// command/action with rtl version
38 /// the command buffer
40 /// adds space between buttons in the toolbar
42 /// a special combox insead of a button
44 /// a special widget to insert tabulars
46 /// a button that expands a menu
48 /// a button that expands a menu but remembers the last choice
56 ToolbarItem(Type type,
57 FuncRequest const & func,
58 docstring const & label = docstring());
60 ToolbarItem(Type type,
61 std::string const & name = std::string(),
62 docstring const & label = docstring());
67 std::shared_ptr<FuncRequest> func; // non-null
79 typedef std::vector<ToolbarItem> Items;
81 typedef Items::const_iterator item_iterator;
83 explicit ToolbarInfo(std::string const & name = std::string())
84 : name(name), allow_auto(false) {}
90 /// allows auto visibility
95 /// read a toolbar from the file
96 ToolbarInfo & read(support::Lexer &);
100 void add(ToolbarItem const &);
107 /// toolbar visibility flags
110 OFF = 2, //< do not show
111 TOP = 4, //< show at top
112 BOTTOM = 8, //< show at bottom
113 LEFT = 16, //< show at left
114 RIGHT = 32, //< show at right
115 AUTO = 64, //< only if AUTO is set, when MATH, TABLE and REVIEW is used
116 MATH = 128, //< show when in math
117 TABLE = 256, //< show when in table
118 REVIEW = 512, //< show when change tracking is enabled
119 MATHMACROTEMPLATE = 1024, //< show in math macro template
120 SAMEROW = 2048, //< place to the current row, no new line
121 IPA = 4096, //< show when in IPA inset
122 MINIBUFFER = 8192, //< show when command-execute has been invoked
123 MINIBUFFER_FOCUS = 16384, //< set focus to minibuffer
124 ALLOWAUTO = MATH | TABLE | REVIEW | MATHMACROTEMPLATE | IPA | MINIBUFFER
127 typedef std::vector<ToolbarInfo> Infos;
134 /// iterator for all toolbars
135 Infos::const_iterator begin() const { return toolbar_info_.begin(); }
137 Infos::const_iterator end() const { return toolbar_info_.end(); }
139 Infos::iterator begin() { return toolbar_info_.begin(); }
141 Infos::iterator end() { return toolbar_info_.end(); }
143 /// read toolbars from the file
144 void readToolbars(support::Lexer &);
146 /// read ui toolbar settings
147 void readToolbarSettings(support::Lexer &);
150 ToolbarInfo const * info(std::string const & name) const;
152 int defaultVisibility(std::string const & name) const;
154 bool isMainToolbar(std::string const & name) const;
157 /// all the defined toolbars
160 std::map<std::string, int> toolbar_visibility_;
163 } // namespace frontend
166 #endif // TOOLBAR_BACKEND_H