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
50 ToolbarItem(Type type,
51 FuncRequest const & func,
52 docstring const & label = docstring());
54 ToolbarItem(Type type,
55 std::string const & name = std::string(),
56 docstring const & label = docstring());
61 std::shared_ptr<FuncRequest> func_; // non-null
73 typedef std::vector<ToolbarItem> Items;
75 typedef Items::const_iterator item_iterator;
77 explicit ToolbarInfo(std::string const & name = std::string())
87 /// read a toolbar from the file
88 ToolbarInfo & read(Lexer &);
92 void add(ToolbarItem const &);
99 /// toolbar visibility flags
102 OFF = 2, //< do not show
103 TOP = 4, //< show at top
104 BOTTOM = 8, //< show at bottom
105 LEFT = 16, //< show at left
106 RIGHT = 32, //< show at right
107 AUTO = 64, //< only if AUTO is set, when MATH, TABLE and REVIEW is used
108 MATH = 128, //< show when in math
109 TABLE = 256, //< show when in table
110 REVIEW = 512, //< show when change tracking is enabled
111 MATHMACROTEMPLATE = 1024, //< show in math macro template
112 SAMEROW = 2048, //< place to the current row, no new line
113 IPA = 4096, //< show when in IPA inset
114 MINIBUFFER = 8192, //< show when command-execute has been invoked
115 MINIBUFFER_FOCUS = 16384, //< set focus to minibuffer
116 ALLOWAUTO = MATH | TABLE | REVIEW | MATHMACROTEMPLATE | IPA | MINIBUFFER
119 typedef std::vector<ToolbarInfo> Infos;
126 /// iterator for all toolbars
127 Infos::const_iterator begin() const { return toolbar_info_.begin(); }
129 Infos::const_iterator end() const { return toolbar_info_.end(); }
131 Infos::iterator begin() { return toolbar_info_.begin(); }
133 Infos::iterator end() { return toolbar_info_.end(); }
135 /// read toolbars from the file
136 void readToolbars(Lexer &);
138 /// read ui toolbar settings
139 void readToolbarSettings(Lexer &);
142 ToolbarInfo const * info(std::string const & name) const;
144 int defaultVisibility(std::string const & name) const;
146 bool isMainToolbar(std::string const & name) const;
149 /// all the defined toolbars
152 std::map<std::string, int> toolbar_visibility_;
155 } // namespace frontend
158 #endif // TOOLBAR_BACKEND_H