4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * \author Jean-Marc Lasgouttes
10 * \author Angus Leeming
11 * \author Abdelrazak Younes
13 * Full author contact details are available in file CREDITS.
21 #include <QAbstractProxyModel>
26 class QSortFilterProxyModel;
27 class QStandardItemModel;
37 class GuiCommandBuffer;
38 class GuiLayoutFilterModel;
41 class LayoutItemDelegate;
45 class GuiLayoutBox : public QComboBox
49 GuiLayoutBox(GuiToolbar * bar, GuiView &);
51 /// select the right layout in the combobox.
52 void set(docstring const & layout);
53 /// Populate the layout combobox.
54 void updateContents(bool reset);
55 /// Add Item to Layout box according to sorting settings from preferences
56 void addItemSort(docstring const & item, docstring const & category,
57 bool sorted, bool sortedByCat, bool unknown);
63 bool eventFilter(QObject * o, QEvent * e);
65 QString const & filter() { return filter_; }
69 void selected(int index);
71 void setIconSize(QSize size);
74 friend class LayoutItemDelegate;
79 void setFilter(QString const & s);
81 QString charFilterRegExp(QString const & filter);
83 void countCategories();
90 DocumentClass const * text_class_;
94 /// the layout model: 1st column translated, 2nd column raw layout name
95 QStandardItemModel * model_;
96 /// the proxy model filtering \c model_
97 GuiLayoutFilterModel * filterModel_;
98 /// the (model-) index of the last successful selection
100 /// the character filter
103 LayoutItemDelegate * layoutItemDelegate_;
105 unsigned visibleCategories_;
111 class GuiToolbar : public QToolBar
116 GuiToolbar(ToolbarInfo const &, GuiView &);
119 void setVisibility(int visibility);
121 /// Add a button to the bar.
122 void add(ToolbarItem const & item);
126 * This key must be used for any session setting.
128 QString sessionKey() const;
129 /// Save session settings.
130 void saveSession() const;
131 /// Restore session settings.
132 void restoreSession();
134 /// Refresh the contents of the bar.
135 void update(bool in_math, bool in_table, bool review,
136 bool in_mathmacrotemplate);
142 GuiCommandBuffer * commandBuffer() { return command_buffer_; }
145 Action * addItem(ToolbarItem const & item);
152 // load flags with saved values
157 void showEvent(QShowEvent *);
162 QList<Action *> actions_;
163 /// initial visibility flags
170 GuiLayoutBox * layout_;
172 GuiCommandBuffer * command_buffer_;
174 ToolbarInfo const & tbinfo_;
179 } // namespace frontend
182 #endif // GUITOOLBAR_H