]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QLToolbar.h
Transfer command buffer handling to QLToolbar.
[lyx.git] / src / frontends / qt4 / QLToolbar.h
1 // -*- C++ -*-
2 /**
3  * \file QLToolbar.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author John Levon
9  * \author Jean-Marc Lasgouttes
10  * \author Angus Leeming
11  * \author Abdelrazak Younes
12  *
13  * Full author contact details are available in file CREDITS.
14  */
15
16 #ifndef QLTOOLBAR_H
17 #define QLTOOLBAR_H
18
19 #include "frontends/Toolbars.h"
20 #include "Session.h"
21
22 #include <QToolBar>
23
24 #include <boost/scoped_ptr.hpp>
25
26 #include <vector>
27
28 class QComboBox;
29
30 namespace lyx {
31 class FuncRequest;
32 namespace frontend {
33
34 class QCommandBuffer;
35 class QLayoutBox;
36 class GuiView;
37 class Action;
38
39
40 class QLayoutBox : public QObject, public LayoutBox {
41         Q_OBJECT
42 public:
43         QLayoutBox(QToolBar *, GuiView &);
44
45         /// select the right layout in the combox.
46         void set(docstring const & layout);
47         /// Populate the layout combox.
48         void update();
49         /// Erase the layout list.
50         void clear();
51         /// Display the layout list.
52         void open();
53         ///
54         void setEnabled(bool);
55
56 private Q_SLOTS:
57         void selected(const QString & str);
58
59 private:
60         QComboBox * combo_;
61         GuiView & owner_;
62 };
63
64
65 class QLToolbar : public QToolBar, public Toolbar {
66         Q_OBJECT
67 public:
68         QLToolbar(ToolbarInfo const &, GuiView &);
69
70         //~QLToolbar();
71
72         void add(ToolbarItem const & item);
73         void hide(bool);
74         void show(bool);
75         bool isVisible() const;
76         void saveInfo(ToolbarSection::ToolbarInfo & info);
77         void update();
78         LayoutBox * layout() const { return layout_.get(); }
79         ///
80         void focusCommandBuffer();
81
82 Q_SIGNALS:
83         void updated();
84
85 private:
86         QCommandBuffer * command_buffer_;
87
88         std::vector<Action *> ActionVector;
89         GuiView & owner_;
90
91         boost::scoped_ptr<QLayoutBox> layout_;
92 };
93
94 /// return a full path of an XPM for the given action
95 std::string const getIcon(FuncRequest const & f, bool unknown = true);
96
97 } // namespace frontend
98 } // namespace lyx
99
100 #endif // NOT QLTOOLBAR_H