]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiToolbar.h
3a5770c008dfc6e476e3b8c67b36078715e15305
[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, public LayoutBox
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 update();
49         /// Erase the layout list.
50         void clear();
51         /// Display the layout list.
52         void open();
53         ///
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, public Toolbar
66 {
67         Q_OBJECT
68 public:
69         GuiToolbar(ToolbarInfo const &, GuiViewBase &);
70
71         void add(ToolbarItem const & item);
72         void hide(bool);
73         void show(bool);
74         bool isVisible() const;
75         void saveInfo(ToolbarSection::ToolbarInfo & info);
76         void update();
77         LayoutBox * layout() const { return layout_; }
78         ///
79         void focusCommandBuffer();
80
81 Q_SIGNALS:
82         void updated();
83
84 private:
85         Action * addItem(ToolbarItem const & item);
86
87         QList<Action *> actions_;
88         GuiViewBase & owner_;
89
90         GuiLayoutBox * layout_;
91         GuiCommandBuffer * command_buffer_;
92 };
93
94 /// return a full path of an XPM for the given action
95 std::string const getIcon(FuncRequest const & f, bool unknown = true);
96
97 } // namespace frontend
98 } // namespace lyx
99
100 #endif // GUITOOLBAR_H