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;
38 class GuiCommandBuffer;
39 class GuiLayoutFilterModel;
41 class LayoutItemDelegate;
43 class GuiLayoutBox : public QComboBox
47 GuiLayoutBox(GuiToolbar * bar, GuiView &);
49 /// select the right layout in the combobox.
50 void set(docstring const & layout);
51 /// Populate the layout combobox.
52 void updateContents(bool reset);
53 /// Add Item to Layout box according to sorting settings from preferences
54 void addItemSort(docstring const & item, docstring const & category,
55 bool sorted, bool sortedByCat);
61 bool eventFilter(QObject * o, QEvent * e);
63 QString const & filter() { return filter_; }
67 void selected(int index);
69 void setIconSize(QSize size);
72 friend class LayoutItemDelegate;
77 void setFilter(QString const & s);
79 QString charFilterRegExp(QString const & filter);
81 void countCategories();
88 DocumentClass const * text_class_;
92 /// the layout model: 1st column translated, 2nd column raw layout name
93 QStandardItemModel * model_;
94 /// the proxy model filtering \c model_
95 GuiLayoutFilterModel * filterModel_;
96 /// the (model-) index of the last successful selection
98 /// the character filter
101 LayoutItemDelegate * layoutItemDelegate_;
103 unsigned visibleCategories_;
109 class GuiToolbar : public QToolBar
113 GuiToolbar(ToolbarInfo const &, GuiView &);
115 /// Add a button to the bar.
116 void add(ToolbarItem const & item);
117 /** update toolbar information
118 * ToolbarInfo will then be saved by session
120 void saveInfo(ToolbarSection::ToolbarInfo & info);
121 /// Refresh the contents of the bar.
122 void updateContents();
124 GuiCommandBuffer * commandBuffer() { return command_buffer_; }
127 Action * addItem(ToolbarItem const & item);
135 QList<Action *> actions_;
140 GuiLayoutBox * layout_;
142 GuiCommandBuffer * command_buffer_;
145 } // namespace frontend
148 #endif // GUITOOLBAR_H