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