]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiToolbar.h
7751474d3f842a468f1584c1b3ac176293edb58a
[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 "GuiCommandBuffer.h"
20
21 #include "Session.h"
22
23 #include <QList>
24 #include <QToolBar>
25 #include <QComboBox>
26
27 namespace lyx {
28
29 class FuncRequest;
30 class ToolbarItem;
31
32 namespace frontend {
33
34 class GuiViewBase;
35 class Action;
36
37
38 class GuiLayoutBox : public QComboBox
39 {
40         Q_OBJECT
41 public:
42         GuiLayoutBox(GuiViewBase &);
43
44         /// select the right layout in the combobox.
45         void set(docstring const & layout);
46         /// Populate the layout combox.
47         void updateContents();
48
49 private Q_SLOTS:
50         void selected(const QString & str);
51
52 private:
53         GuiViewBase & owner_;
54 };
55
56
57 class GuiToolbar : public QToolBar
58 {
59         Q_OBJECT
60 public:
61         GuiToolbar(ToolbarInfo const &, GuiViewBase &);
62
63         /// Add a button to the bar.
64         void add(ToolbarItem const & item);
65         /** update toolbar information
66         * ToolbarInfo will then be saved by session
67         */
68         void saveInfo(ToolbarSection::ToolbarInfo & info);
69         /// Refresh the contents of the bar.
70         void updateContents();
71         GuiLayoutBox * layout() const { return layout_; }
72         ///
73         GuiCommandBuffer * commandBuffer() { return command_buffer_; }
74
75 Q_SIGNALS:
76         void updated();
77
78 private:
79         Action * addItem(ToolbarItem const & item);
80
81         QList<Action *> actions_;
82         GuiViewBase & owner_;
83
84         GuiLayoutBox * layout_;
85         GuiCommandBuffer * command_buffer_;
86 };
87
88 /// return a full path of an .png for the given action
89 std::string const getIcon(FuncRequest const & f, bool unknown = true);
90
91 } // namespace frontend
92 } // namespace lyx
93
94 #endif // GUITOOLBAR_H