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