]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiToolbar.h
This is the last of a series of patches that merges the layout modules development...
[lyx.git] / src / frontends / qt4 / GuiToolbar.h
1 // -*- C++ -*-
2 /**
3  * \file GuiToolbar.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 GUITOOLBAR_H
17 #define GUITOOLBAR_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
32 class FuncRequest;
33
34 namespace frontend {
35
36 class GuiCommandBuffer;
37 class GuiLayoutBox;
38 class GuiViewBase;
39 class Action;
40
41
42 class GuiLayoutBox : public QObject, public LayoutBox
43 {
44         Q_OBJECT
45 public:
46         GuiLayoutBox(QToolBar *, GuiViewBase &);
47
48         /// select the right layout in the combox.
49         void set(docstring const & layout);
50         /// Populate the layout combox.
51         void update();
52         /// Erase the layout list.
53         void clear();
54         /// Display the layout list.
55         void open();
56         ///
57         void setEnabled(bool);
58
59 private Q_SLOTS:
60         void selected(const QString & str);
61
62 private:
63         QComboBox * combo_;
64         GuiViewBase & owner_;
65 };
66
67
68 class GuiToolbar : public QToolBar, public Toolbar
69 {
70         Q_OBJECT
71 public:
72         GuiToolbar(ToolbarInfo const &, GuiViewBase &);
73
74         //~GuiToolbar();
75
76         void add(ToolbarItem const & item);
77         void hide(bool);
78         void show(bool);
79         bool isVisible() const;
80         void saveInfo(ToolbarSection::ToolbarInfo & info);
81         void update();
82         LayoutBox * layout() const { return layout_.get(); }
83         ///
84         void focusCommandBuffer();
85
86 Q_SIGNALS:
87         void updated();
88
89 private:
90         GuiCommandBuffer * command_buffer_;
91
92         std::vector<Action *> ActionVector;
93         GuiViewBase & owner_;
94
95         boost::scoped_ptr<GuiLayoutBox> layout_;
96 };
97
98 /// return a full path of an XPM for the given action
99 std::string const getIcon(FuncRequest const & f, bool unknown = true);
100
101 } // namespace frontend
102 } // namespace lyx
103
104 #endif // GUITOOLBAR_H