3 * \file qt2/Toolbar_pimpl.h
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 * Full author contact details are available in file CREDITS
12 #ifndef TOOLBAR_PIMPL_H
13 #define TOOLBAR_PIMPL_H
19 #include "frontends/Toolbar.h"
21 #include "qt_helpers.h"
23 #include <boost/scoped_ptr.hpp>
28 #include <qtoolbutton.h>
35 struct Toolbar::Pimpl {
37 friend class ToolbarProxy;
39 Pimpl(LyXView * o, int x, int y);
43 /// add a new button to the toolbar.
46 /// update the state of the icons
49 /// select the right layout in the combox
50 void setLayout(string const & layout);
51 /// Populate the layout combox; re-do everything if force is true.
52 void updateLayoutList(bool force);
53 /// Drop down the layout list
54 void openLayoutList();
55 /// Erase the layout list
56 void clearLayoutList();
58 void changed_layout(string const & sel);
60 void button_selected(QToolButton * button);
64 boost::scoped_ptr<ToolbarProxy> proxy_;
66 std::vector<QToolBar *> toolbars_;
70 typedef std::map<QToolButton *, int> ButtonMap;
76 // moc is mind-numbingly stupid
77 class ToolbarProxy : public QObject {
80 ToolbarProxy(Toolbar::Pimpl & owner)
84 void layout_selected(const QString & str) {
85 owner_.changed_layout(fromqstr(str));
88 void button_selected() {
89 owner_.button_selected(
90 const_cast<QToolButton *>(
91 static_cast<QToolButton const *>(sender()))
95 Toolbar::Pimpl & owner_;