// -*- C++ -*- /** * \file qt2/Toolbar_pimpl.h * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * * \author Lars Gullik Bjønnes * \author John Levon * \author Jean-Marc Lasgouttes * * Full author contact details are available in file CREDITS. */ #ifndef QLTOOLBAR__H #define QLTOOLBAR_H #include "frontends/Toolbar.h" #include "qt_helpers.h" #include #include #include #include #include class QtView; class QToolBar; class QLComboBox; class ToolbarProxy; class QLToolbar : public Toolbar { public: friend class ToolbarProxy; QLToolbar(LyXView * o); /// add a new toolbar void add(ToolbarBackend::Toolbar const & tb); /// add an item to a toolbar void add(QToolBar * tb, int action, string const & tooltip); /// show or hide a toolbar void displayToolbar(ToolbarBackend::Toolbar const & tb, bool show); /// update the state of the icons void update(); /// select the right layout in the combox void setLayout(string const & layout); /// Populate the layout combox. void updateLayoutList(); /// Drop down the layout list void openLayoutList(); /// Erase the layout list void clearLayoutList(); private: void changed_layout(string const & sel); void button_selected(QToolButton * button); QtView * owner_; boost::scoped_ptr proxy_; std::map toolbars_; QLComboBox * combo_; typedef std::map ButtonMap; ButtonMap map_; }; // moc is mind-numbingly stupid class ToolbarProxy : public QObject { Q_OBJECT public: ToolbarProxy(QLToolbar & owner) : owner_(owner) {} public slots: void layout_selected(const QString & str) { owner_.changed_layout(fromqstr(str)); } void button_selected() { owner_.button_selected( const_cast( static_cast(sender())) ); } private: QLToolbar & owner_; }; #endif