]> git.lyx.org Git - features.git/blob - src/frontends/qt4/GuiToolbar.h
ee5476b9c0e34d28d0a2b7bff11876bc41085034
[features.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         /// Add Item to Layout box according to sorting settings from preferences
47         void addItemSort(QString const & item, bool sorted);
48
49 private Q_SLOTS:
50         void selected(const QString & str);
51
52 private:
53         GuiView & owner_;
54 };
55
56
57 class GuiToolbar : public QToolBar
58 {
59         Q_OBJECT
60 public:
61         GuiToolbar(ToolbarInfo const &, GuiView &);
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         GuiView & owner_;
83
84         GuiLayoutBox * layout_;
85         GuiCommandBuffer * command_buffer_;
86 };
87
88 } // namespace frontend
89 } // namespace lyx
90
91 #endif // GUITOOLBAR_H