]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiToolbars.h
Some fixes and cleanup to command buffer.
[lyx.git] / src / frontends / qt4 / GuiToolbars.h
1 // -*- C++ -*-
2 /**
3  * \file GuiToolbars.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 Angus Leeming
9  * \author Abdelrazak Younes
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef GUI_TOOLBARS_H
15 #define GUI_TOOLBARS_H
16
17 #include "TextClass.h"
18 #include "ToolbarBackend.h"
19 #include "Session.h"
20
21 #include <map>
22
23 namespace lyx {
24 namespace frontend {
25
26 class GuiLayoutBox;
27 class GuiToolbar;
28 class GuiViewBase;
29
30 class GuiToolbars
31 {
32 public:
33         ///
34         GuiToolbars(GuiViewBase & owner);
35
36         /// Initialize the toolbars using the backend database.
37         void init();
38
39         /// Show/hide the named toolbar.
40         void display(std::string const & name, bool show);
41
42         /// get toolbar info
43         ToolbarInfo * getToolbarInfo(std::string const & name);
44
45         /** toggle the state of toolbars (on/off/auto). Skip "auto"
46          * when allowauto is false.
47          */
48         void toggleToolbarState(std::string const & name, bool allowauto);
49
50         /// Update the state of the toolbars.
51         void update(bool in_math, bool in_table, bool review);
52
53         /// Is the Toolbar currently visible?
54         bool visible(std::string const & name) const;
55
56         /// save toolbar information
57         void saveToolbarInfo();
58
59         /// Select the right layout in the combox.
60         void setLayout(docstring const & layout);
61
62         /** Populate the layout combox - returns whether we did a full
63          *  update or not
64          */
65         bool updateLayoutList(TextClassPtr textclass);
66
67         /// Drop down the layout list.
68         void openLayoutList();
69         /// Erase the layout list.
70         void clearLayoutList();
71
72         /// Show or hide the command buffer.
73         void showCommandBuffer(bool show_it);
74
75
76 private:
77         /// Add a new toolbar. if newline==true, start from a new line
78         void add(ToolbarInfo const & tbinfo, bool newline);
79
80         /// Show or hide a toolbar.
81         void displayToolbar(ToolbarInfo const & tbinfo, bool show);
82
83         /// Update the state of the icons
84         void updateIcons();
85
86         // load flags with saved values
87         void initFlags(ToolbarInfo & tbinfo);
88
89         /// The parent window.
90         GuiViewBase & owner_;
91
92         /** The layout box is actually owned by whichever toolbar
93          *  contains it. All the Toolbars class needs is a means of
94          *  accessing it.
95          *
96          *  We don't need to use boost::weak_ptr here because the toolbars
97          *  are also stored here. There are, therefore, no lifetime issues.
98          */
99         GuiLayoutBox * layout_;
100
101         /// Toolbar store providing access to individual toolbars by name.
102         typedef std::map<std::string, GuiToolbar *> ToolbarsMap;
103         ToolbarsMap toolbars_;
104
105         /// The last textclass layout list in the layout choice selector
106         TextClassPtr last_textclass_;
107 };
108
109
110 } // namespace frontend
111 } // namespace lyx
112
113 #endif // NOT GUI_TOOLBARS_H