]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiToolbar.h
Add missing initialization
[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 <QList>
20 #include <QToolBar>
21 #include <QToolButton>
22
23 namespace lyx {
24
25 class DocumentClass;
26 class Inset;
27
28 namespace frontend {
29
30 class Action;
31 class GuiCommandBuffer;
32 class GuiLayoutFilterModel;
33 class GuiToolbar;
34 class GuiView;
35 class LayoutBox;
36 class ToolbarInfo;
37 class ToolbarItem;
38
39 class MenuButton : public QToolButton
40 {
41         Q_OBJECT
42 public:
43         ///
44         MenuButton(GuiToolbar * bar, ToolbarItem const & item,
45                 bool const sticky = false);
46
47 private:
48         ///
49         void initialize();
50         ///
51         GuiToolbar * bar_;
52         ///
53         ToolbarItem const & tbitem_;
54
55 private Q_SLOTS:
56         ///
57         void actionTriggered(QAction * action);
58         ///
59         void updateTriggered();
60 };
61
62
63
64 class GuiToolbar : public QToolBar
65 {
66         Q_OBJECT
67 public:
68         ///
69         GuiToolbar(ToolbarInfo const &, GuiView &);
70         
71         /// Reimplemented from QToolbar to detect whether the 
72         /// toolbar is restored with MainWindow::restoreState().
73         void setVisible(bool visible);
74
75         ///
76         void setVisibility(int visibility);
77
78         /// Add a button to the bar.
79         void add(ToolbarItem const & item);
80
81         /// Session key.
82         /**
83          * This key must be used for any session setting.
84          **/
85         QString sessionKey() const;
86         /// Save session settings.
87         void saveSession() const;
88         /// Restore session settings.
89         void restoreSession();
90
91         ///
92         bool isRestored() const;
93
94         /// Refresh the contents of the bar.
95         void update(int context = 0);
96
97         ///
98         void toggle();
99
100         ///
101         GuiCommandBuffer * commandBuffer() { return command_buffer_; }
102
103         ///
104         Action * addItem(ToolbarItem const & item);
105
106 Q_SIGNALS:
107         ///
108         void updated();
109
110 private:
111         // load flags with saved values
112         void initFlags();
113         ///
114         void fill();
115         ///
116         void showEvent(QShowEvent *);
117
118         ///
119         QList<Action *> actions_;
120         /// initial visibility flags
121         int visibility_;
122         ///
123         GuiView & owner_;
124         ///
125         GuiCommandBuffer * command_buffer_;
126         ///
127         ToolbarInfo const & tbinfo_;
128         ///
129         bool filled_;
130         ///
131         bool restored_;
132 };
133
134 } // namespace frontend
135 } // namespace lyx
136
137 #endif // GUITOOLBAR_H