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"
32 /// command/action with rtl version
36 /// the command buffer
38 /// adds space between buttons in the toolbar
40 /// a special combox insead of a button
42 /// a special widget to insert tabulars
44 /// a button that expands a menu
46 /// a button that expands a menu but remembers the last choice
54 ToolbarItem(Type type,
55 FuncRequest const & func,
56 docstring const & label = docstring());
58 ToolbarItem(Type type,
59 std::string const & name = std::string(),
60 docstring const & label = docstring());
65 std::shared_ptr<FuncRequest> func; // non-null
77 typedef std::vector<ToolbarItem> Items;
79 typedef Items::const_iterator item_iterator;
81 explicit ToolbarInfo(std::string const & name = std::string())
91 /// read a toolbar from the file
92 ToolbarInfo & read(Lexer &);
96 void add(ToolbarItem const &);
103 /// toolbar visibility flags
106 OFF = 2, //< do not show
107 TOP = 4, //< show at top
108 BOTTOM = 8, //< show at bottom
109 LEFT = 16, //< show at left
110 RIGHT = 32, //< show at right
111 AUTO = 64, //< only if AUTO is set, when MATH, TABLE and REVIEW is used
112 MATH = 128, //< show when in math
113 TABLE = 256, //< show when in table
114 REVIEW = 512, //< show when change tracking is enabled
115 MATHMACROTEMPLATE = 1024, //< show in math macro template
116 SAMEROW = 2048, //< place to the current row, no new line
117 IPA = 4096, //< show when in IPA inset
118 MINIBUFFER = 8192, //< show when command-execute has been invoked
119 MINIBUFFER_FOCUS = 16384, //< set focus to minibuffer
120 ALLOWAUTO = MATH | TABLE | REVIEW | MATHMACROTEMPLATE | IPA | MINIBUFFER
123 typedef std::vector<ToolbarInfo> Infos;
130 /// iterator for all toolbars
131 Infos::const_iterator begin() const { return toolbar_info_.begin(); }
133 Infos::const_iterator end() const { return toolbar_info_.end(); }
135 Infos::iterator begin() { return toolbar_info_.begin(); }
137 Infos::iterator end() { return toolbar_info_.end(); }
139 /// read toolbars from the file
140 void readToolbars(Lexer &);
142 /// read ui toolbar settings
143 void readToolbarSettings(Lexer &);
146 ToolbarInfo const * info(std::string const & name) const;
148 int defaultVisibility(std::string const & name) const;
150 bool isMainToolbar(std::string const & name) const;
153 /// all the defined toolbars
156 std::map<std::string, int> toolbar_visibility_;
159 } // namespace frontend
162 #endif // TOOLBAR_BACKEND_H