3 * \file 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"
22 #include <qtoolbutton.h>
24 #include <boost/scoped_ptr.hpp>
33 struct Toolbar::Pimpl {
35 friend class ToolbarProxy;
38 Pimpl(LyXView * o, int x, int y);
42 /// add a new button to the toolbar.
45 /// update the state of the icons
48 /// select the right layout in the combox
49 void setLayout(string const & layout);
50 /// Populate the layout combox; re-do everything if force is true.
51 void updateLayoutList(bool force);
52 /// Drop down the layout list
53 void openLayoutList();
54 /// Erase the layout list
55 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;
77 // moc is mind-numbingly stupid
78 class ToolbarProxy : public QObject {
82 ToolbarProxy(Toolbar::Pimpl & owner)
87 void layout_selected(const QString & str) {
88 owner_.changed_layout(str.latin1());
91 void button_selected() {
92 owner_.button_selected(
93 const_cast<QToolButton *>(
94 static_cast<QToolButton const *>(sender()))
99 Toolbar::Pimpl & owner_;