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