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