]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiToolbar.h
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / frontends / qt4 / GuiToolbar.h
index 22fa09301414935f83e0eb58adbcdc866e4fb48f..57650ac8eff18664b23ac36badc77dc40350e60f 100644 (file)
 #ifndef GUITOOLBAR_H
 #define GUITOOLBAR_H
 
-#include "frontends/Toolbars.h"
 #include "Session.h"
 
+#include <QAbstractProxyModel>
+#include <QComboBox>
+#include <QList>
 #include <QToolBar>
 
-#include <boost/scoped_ptr.hpp>
-
-#include <vector>
-
-class QComboBox;
+class QSortFilterProxyModel;
+class QStandardItemModel;
 
 namespace lyx {
 
-class FuncRequest;
+class DocumentClass;
+class Inset;
+class ToolbarItem;
 
 namespace frontend {
 
-class GuiCommandBuffer;
-class GuiLayoutBox;
-class GuiViewBase;
 class Action;
+class GuiCommandBuffer;
+class GuiLayoutFilterModel;
+class GuiView;
+class LayoutItemDelegate;
 
-
-class GuiLayoutBox : public QObject, public LayoutBox {
+class GuiLayoutBox : public QComboBox
+{
        Q_OBJECT
 public:
-       GuiLayoutBox(QToolBar *, GuiViewBase &);
+       GuiLayoutBox(GuiToolbar * bar, GuiView &);
 
-       /// select the right layout in the combox.
+       /// select the right layout in the combobox.
        void set(docstring const & layout);
-       /// Populate the layout combox.
-       void update();
-       /// Erase the layout list.
-       void clear();
-       /// Display the layout list.
-       void open();
+       /// Populate the layout combobox.
+       void updateContents(bool reset);
+       /// Add Item to Layout box according to sorting settings from preferences
+       void addItemSort(docstring const & item, docstring const & category,
+               bool sorted, bool sortedByCat);
+
+       ///
+       void showPopup();
+       
        ///
-       void setEnabled(bool);
+       bool eventFilter(QObject * o, QEvent * e);
+       ///
+       QString const & filter() { return filter_; }
 
 private Q_SLOTS:
-       void selected(const QString & str);
+       ///
+       void selected(int index);
+       ///
+       void setIconSize(QSize size);
 
 private:
-       QComboBox * combo_;
-       GuiViewBase & owner_;
+       friend class LayoutItemDelegate;
+
+       ///
+       void resetFilter();
+       ///
+       void setFilter(QString const & s);
+       ///
+       QString charFilterRegExp(QString const & filter);
+       ///
+       void countCategories();
+       
+       ///
+       GuiView & owner_;
+       ///
+       GuiToolbar * bar_;
+       ///
+       DocumentClass const * text_class_;
+       ///
+       Inset const * inset_;
+       
+       /// the layout model: 1st column translated, 2nd column raw layout name
+       QStandardItemModel * model_;
+       /// the proxy model filtering \c model_
+       GuiLayoutFilterModel * filterModel_;
+       /// the (model-) index of the last successful selection
+       int lastSel_;
+       /// the character filter
+       QString filter_;
+       ///
+       LayoutItemDelegate * layoutItemDelegate_;
+       ///
+       unsigned visibleCategories_;
+       ///
+       bool inShowPopup_;
 };
 
 
-class GuiToolbar : public QToolBar, public Toolbar {
+class GuiToolbar : public QToolBar
+{
        Q_OBJECT
 public:
-       GuiToolbar(ToolbarInfo const &, GuiViewBase &);
-
-       //~GuiToolbar();
+       GuiToolbar(ToolbarInfo const &, GuiView &);
 
+       /// Add a button to the bar.
        void add(ToolbarItem const & item);
-       void hide(bool);
-       void show(bool);
-       bool isVisible() const;
+       /** update toolbar information
+       * ToolbarInfo will then be saved by session
+       */
        void saveInfo(ToolbarSection::ToolbarInfo & info);
-       void update();
-       LayoutBox * layout() const { return layout_.get(); }
+       /// Refresh the contents of the bar.
+       void updateContents();
+       ///
+       GuiCommandBuffer * commandBuffer() { return command_buffer_; }
+
        ///
-       void focusCommandBuffer();
+       Action * addItem(ToolbarItem const & item);
 
 Q_SIGNALS:
+       ///
        void updated();
 
 private:
-       GuiCommandBuffer * command_buffer_;
-
-       std::vector<Action *> ActionVector;
-       GuiViewBase & owner_;
+       ///
+       QList<Action *> actions_;
+       ///
+       GuiView & owner_;
 
-       boost::scoped_ptr<GuiLayoutBox> layout_;
+       ///
+       GuiLayoutBox * layout_;
+       ///
+       GuiCommandBuffer * command_buffer_;
 };
 
-/// return a full path of an XPM for the given action
-std::string const getIcon(FuncRequest const & f, bool unknown = true);
-
 } // namespace frontend
 } // namespace lyx