3 * \file Toolbar_pimpl.h
4 * Copyright 2002 the LyX Team
5 * Copyright 1996-2001 Lars Gullik Bjønnes
6 * Read the file COPYING
8 * \author Lars Gullik Bjønnes, larsbj@lyx.org
11 #ifndef TOOLBAR_PIMPL_H
12 #define TOOLBAR_PIMPL_H
18 #include <boost/smart_ptr.hpp>
20 #include "frontends/Toolbar.h"
27 #include <qtoolbutton.h>
34 struct Toolbar::Pimpl {
36 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();
59 void changed_layout(string const & sel);
61 void button_selected(QToolButton * button);
65 boost::scoped_ptr<ToolbarProxy> proxy_;
67 std::vector<QToolBar *> toolbars_;
71 typedef std::map<QToolButton *, int> ButtonMap;
78 // moc is mind-numbingly stupid
79 class ToolbarProxy : public QObject {
83 ToolbarProxy(Toolbar::Pimpl & owner)
88 void layout_selected(const QString & str) {
89 owner_.changed_layout(str.latin1());
92 void button_selected() {
93 owner_.button_selected(
94 const_cast<QToolButton *>(
95 static_cast<QToolButton const *>(sender()))
100 Toolbar::Pimpl & owner_;