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 * \author Jean-Marc Lasgouttes
11 * Full author contact details are available in file CREDITS.
17 #include "frontends/Toolbar.h"
19 #include "qt_helpers.h"
21 #include <boost/scoped_ptr.hpp>
26 #include <qtoolbutton.h>
34 class QLToolbar : public Toolbar {
36 friend class ToolbarProxy;
38 QLToolbar(LyXView * o);
41 void add(ToolbarBackend::Toolbar const & tb);
43 /// add an item to a toolbar
44 void add(QToolBar * tb, FuncRequest const &, std::string const & tooltip);
46 /// show or hide a toolbar
47 void displayToolbar(ToolbarBackend::Toolbar const & tb, bool show);
49 /// update the state of the icons
52 /// select the right layout in the combox
53 void setLayout(std::string const & layout);
54 /// Populate the layout combox.
55 void updateLayoutList();
56 /// Drop down the layout list
57 void openLayoutList();
58 /// Erase the layout list
59 void clearLayoutList();
61 void changed_layout(std::string const & sel);
63 void button_selected(QToolButton * button);
67 boost::scoped_ptr<ToolbarProxy> proxy_;
69 std::map<std::string, QToolBar *> toolbars_;
73 typedef std::map<QToolButton *, FuncRequest> ButtonMap;
79 // moc is mind-numbingly stupid
80 class ToolbarProxy : public QObject {
83 ToolbarProxy(QLToolbar & owner)
87 void layout_selected(const QString & str) {
88 owner_.changed_layout(fromqstr(str));
91 void button_selected() {
92 owner_.button_selected(
93 const_cast<QToolButton *>(
94 static_cast<QToolButton const *>(sender()))