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 <boost/scoped_ptr.hpp>
26 #include <qtoolbutton.h>
33 struct Toolbar::Pimpl {
35 friend class ToolbarProxy;
37 Pimpl(LyXView * o, int x, int y);
41 /// add a new button to the toolbar.
44 /// update the state of the icons
47 /// select the right layout in the combox
48 void setLayout(string const & layout);
49 /// Populate the layout combox; re-do everything if force is true.
50 void updateLayoutList(bool force);
51 /// Drop down the layout list
52 void openLayoutList();
53 /// Erase the layout list
54 void clearLayoutList();
56 void changed_layout(string const & sel);
58 void button_selected(QToolButton * button);
62 boost::scoped_ptr<ToolbarProxy> proxy_;
64 std::vector<QToolBar *> toolbars_;
68 typedef std::map<QToolButton *, int> ButtonMap;
74 // moc is mind-numbingly stupid
75 class ToolbarProxy : public QObject {
78 ToolbarProxy(Toolbar::Pimpl & owner)
82 void layout_selected(const QString & str) {
83 owner_.changed_layout(str.latin1());
86 void button_selected() {
87 owner_.button_selected(
88 const_cast<QToolButton *>(
89 static_cast<QToolButton const *>(sender()))
93 Toolbar::Pimpl & owner_;