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;
40 Pimpl(LyXView * o, Dialogs &, int x, int y);
44 /// (re)sets the toolbar
45 void set(bool doingmain = false);
49 /** this is to be the entry point to the toolbar
50 frame, where you can change the toolbar realtime.
53 /// add a new button to the toolbar.
54 void add(int, bool doclean = true);
55 /// invokes the n'th icon in the toolbar
57 /// update the state of the icons
60 /// select the right layout in the combox
61 void setLayout(string const & layout);
62 /// Populate the layout combox; re-do everything if force is true.
63 void updateLayoutList(bool force);
64 /// Drop down the layout list
65 void openLayoutList();
66 /// Erase the layout list
67 void clearLayoutList();
70 void changed_layout(string const & sel);
72 void button_selected(QToolButton * button);
76 boost::scoped_ptr<ToolbarProxy> proxy_;
78 std::vector<QToolBar *> toolbars_;
82 typedef std::map<QToolButton *, int> ButtonMap;
89 // moc is mind-numbingly stupid
90 class ToolbarProxy : public QObject {
94 ToolbarProxy(Toolbar::Pimpl & owner)
99 void layout_selected(const QString & str) {
100 owner_.changed_layout(str.latin1());
103 void button_selected() {
104 owner_.button_selected(
105 const_cast<QToolButton *>(
106 static_cast<QToolButton const *>(sender()))
111 Toolbar::Pimpl & owner_;