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())
92 /// read a toolbar from the file
93 ToolbarInfo & read(Lexer &);
97 void add(ToolbarItem const &);
104 /// toolbar visibility flags
107 OFF = 2, //< do not show
108 TOP = 4, //< show at top
109 BOTTOM = 8, //< show at bottom
110 LEFT = 16, //< show at left
111 RIGHT = 32, //< show at right
112 AUTO = 64, //< only if AUTO is set, when MATH, TABLE and REVIEW is used
113 MATH = 128, //< show when in math
114 TABLE = 256, //< show when in table
115 REVIEW = 512, //< show when change tracking is enabled
116 MATHMACROTEMPLATE = 1024, //< show in math macro template
117 SAMEROW = 2048, //< place to the current row, no new line
118 IPA = 4096, //< show when in IPA inset
119 MINIBUFFER = 8192, //< show when command-execute has been invoked
120 MINIBUFFER_FOCUS = 16384, //< set focus to minibuffer
121 ALLOWAUTO = MATH | TABLE | REVIEW | MATHMACROTEMPLATE | IPA | MINIBUFFER
124 typedef std::vector<ToolbarInfo> Infos;
131 /// iterator for all toolbars
132 Infos::const_iterator begin() const { return toolbar_info_.begin(); }
134 Infos::const_iterator end() const { return toolbar_info_.end(); }
136 Infos::iterator begin() { return toolbar_info_.begin(); }
138 Infos::iterator end() { return toolbar_info_.end(); }
140 /// read toolbars from the file
141 void readToolbars(Lexer &);
143 /// read ui toolbar settings
144 void readToolbarSettings(Lexer &);
147 ToolbarInfo const * info(std::string const & name) const;
149 int defaultVisibility(std::string const & name) const;
151 bool isMainToolbar(std::string const & name) const;
154 /// all the defined toolbars
157 std::map<std::string, int> toolbar_visibility_;
160 } // namespace frontend
163 #endif // TOOLBAR_BACKEND_H