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
16 #include "frontends/Toolbar.h"
18 #include "qt_helpers.h"
20 #include <boost/scoped_ptr.hpp>
25 #include <qtoolbutton.h>
32 struct Toolbar::Pimpl {
34 friend class ToolbarProxy;
36 Pimpl(LyXView * o, int x, int y);
40 /// add a new button to the toolbar.
43 /// update the state of the icons
46 /// select the right layout in the combox
47 void setLayout(string const & layout);
48 /// Populate the layout combox; re-do everything if force is true.
49 void updateLayoutList(bool force);
50 /// Drop down the layout list
51 void openLayoutList();
52 /// Erase the layout list
53 void clearLayoutList();
55 void changed_layout(string const & sel);
57 void button_selected(QToolButton * button);
61 boost::scoped_ptr<ToolbarProxy> proxy_;
63 std::vector<QToolBar *> toolbars_;
67 typedef std::map<QToolButton *, int> ButtonMap;
73 // moc is mind-numbingly stupid
74 class ToolbarProxy : public QObject {
77 ToolbarProxy(Toolbar::Pimpl & owner)
81 void layout_selected(const QString & str) {
82 owner_.changed_layout(fromqstr(str));
85 void button_selected() {
86 owner_.button_selected(
87 const_cast<QToolButton *>(
88 static_cast<QToolButton const *>(sender()))
92 Toolbar::Pimpl & owner_;