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