]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiToolbar.h
Fix bug 4594.
[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 Inset;
28 class DocumentClass;
29 class ToolbarItem;
30
31 namespace frontend {
32
33 class GuiCommandBuffer;
34 class GuiView;
35 class Action;
36
37
38 class GuiLayoutBox : public QComboBox
39 {
40         Q_OBJECT
41 public:
42         GuiLayoutBox(GuiView &);
43
44         /// select the right layout in the combobox.
45         void set(docstring const & layout);
46         /// Populate the layout combobox.
47         void updateContents(bool reset);
48         /// Add Item to Layout box according to sorting settings from preferences
49         void addItemSort(QString const & item, bool sorted);
50
51 private Q_SLOTS:
52         void selected(const QString & str);
53
54 private:
55         GuiView & owner_;
56         DocumentClass const * text_class_;
57         Inset const * inset_;
58 };
59
60
61 class GuiToolbar : public QToolBar
62 {
63         Q_OBJECT
64 public:
65         GuiToolbar(ToolbarInfo const &, GuiView &);
66
67         /// Add a button to the bar.
68         void add(ToolbarItem const & item);
69         /** update toolbar information
70         * ToolbarInfo will then be saved by session
71         */
72         void saveInfo(ToolbarSection::ToolbarInfo & info);
73         /// Refresh the contents of the bar.
74         void updateContents();
75         ///
76         GuiCommandBuffer * commandBuffer() { return command_buffer_; }
77
78         Action * addItem(ToolbarItem const & item);
79
80 Q_SIGNALS:
81         void updated();
82
83 private:
84
85         QList<Action *> actions_;
86         GuiView & owner_;
87
88         GuiLayoutBox * layout_;
89         GuiCommandBuffer * command_buffer_;
90 };
91
92 } // namespace frontend
93 } // namespace lyx
94
95 #endif // GUITOOLBAR_H