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"
17 #include "ToolbarBackend.h"
19 #include "qt_helpers.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);
42 void add(ToolbarBackend::Toolbar const & tb);
44 /// add an item to a toolbar
45 void add(QToolBar * tb, int action, string const & tooltip);
47 /// show or hide a toolbar
48 void displayToolbar(ToolbarBackend::Toolbar const & tb, bool show);
50 /// update the state of the icons
53 /// select the right layout in the combox
54 void setLayout(string const & layout);
55 /// Populate the layout combox; re-do everything if force is true.
56 void updateLayoutList(bool force);
57 /// Drop down the layout list
58 void openLayoutList();
59 /// Erase the layout list
60 void clearLayoutList();
62 void changed_layout(string const & sel);
64 void button_selected(QToolButton * button);
68 boost::scoped_ptr<ToolbarProxy> proxy_;
70 std::map<string, QToolBar *> toolbars_;
74 typedef std::map<QToolButton *, int> ButtonMap;
80 // moc is mind-numbingly stupid
81 class ToolbarProxy : public QObject {
84 ToolbarProxy(Toolbar::Pimpl & owner)
88 void layout_selected(const QString & str) {
89 owner_.changed_layout(fromqstr(str));
92 void button_selected() {
93 owner_.button_selected(
94 const_cast<QToolButton *>(
95 static_cast<QToolButton const *>(sender()))
99 Toolbar::Pimpl & owner_;