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