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"
33 /// command/action with rtl version
37 /// the command buffer
39 /// adds space between buttons in the toolbar
41 /// a special combox insead of a button
43 /// a special widget to insert tabulars
45 /// a button that expands a menu
47 /// a button that expands a menu but remembers the last choice
55 ToolbarItem(Type type,
56 FuncRequest const & func,
57 docstring const & label = docstring());
59 ToolbarItem(Type type,
60 std::string const & name = std::string(),
61 docstring const & label = docstring());
66 std::shared_ptr<FuncRequest> func; // non-null
78 typedef std::vector<ToolbarItem> Items;
80 typedef Items::const_iterator item_iterator;
82 explicit ToolbarInfo(std::string const & name = std::string())
83 : name(name), allow_auto(false) {}
89 /// allows auto visibility
94 /// read a toolbar from the file
95 ToolbarInfo & read(Lexer &);
99 void add(ToolbarItem const &);
106 /// toolbar visibility flags
109 OFF = 2, //< do not show
110 TOP = 4, //< show at top
111 BOTTOM = 8, //< show at bottom
112 LEFT = 16, //< show at left
113 RIGHT = 32, //< show at right
114 AUTO = 64, //< only if AUTO is set, when MATH, TABLE and REVIEW is used
115 MATH = 128, //< show when in math
116 TABLE = 256, //< show when in table
117 REVIEW = 512, //< show when change tracking is enabled
118 MATHMACROTEMPLATE = 1024, //< show in math macro template
119 SAMEROW = 2048, //< place to the current row, no new line
120 IPA = 4096, //< show when in IPA inset
121 MINIBUFFER = 8192, //< show when command-execute has been invoked
122 MINIBUFFER_FOCUS = 16384, //< set focus to minibuffer
123 ALLOWAUTO = MATH | TABLE | REVIEW | MATHMACROTEMPLATE | IPA | MINIBUFFER
126 typedef std::vector<ToolbarInfo> Infos;
133 /// iterator for all toolbars
134 Infos::const_iterator begin() const { return toolbar_info_.begin(); }
136 Infos::const_iterator end() const { return toolbar_info_.end(); }
138 Infos::iterator begin() { return toolbar_info_.begin(); }
140 Infos::iterator end() { return toolbar_info_.end(); }
142 /// read toolbars from the file
143 void readToolbars(Lexer &);
145 /// read ui toolbar settings
146 void readToolbarSettings(Lexer &);
149 ToolbarInfo const * info(std::string const & name) const;
151 int defaultVisibility(std::string const & name) const;
153 bool isMainToolbar(std::string const & name) const;
156 /// all the defined toolbars
159 std::map<std::string, int> toolbar_visibility_;
162 } // namespace frontend
165 #endif // TOOLBAR_BACKEND_H