]> git.lyx.org Git - features.git/blob - src/frontends/Toolbars.h
Move most of the Gui specific code in Toolbars to its new qt4 specialization GuiToolbars.
[features.git] / src / frontends / Toolbars.h
1 // -*- C++ -*-
2 /**
3  * \file Toolbars.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  *
10  * Full author contact details are available in file CREDITS.
11  *
12  * The Toolbars class is a container of toolbars.
13  * It provides accessors to each Toolbar and to the LayoutBox.
14  *
15  * Each GUI frontend should provide toolbar and layout boxes by derivation
16  * from the LayoutBox and Toolbar pure abstract classes.
17  *
18  * The Toolbars class has no knowledge at all of the details of each
19  * frontend's implementation, which requires that each frontend should
20  * provide a 'make_toolbar' function, signature below.
21  */
22
23 #ifndef TOOLBARS_H
24 #define TOOLBARS_H
25
26 #include "TextClass.h"
27 #include "ToolbarBackend.h"
28 #include "Session.h"
29
30 namespace lyx {
31 namespace frontend {
32
33 class Toolbars {
34 public:
35         ///
36         Toolbars();
37         virtual ~Toolbars() {}
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         virtual bool visible(std::string const & name) const = 0;
58
59         /// save toolbar information
60         virtual void saveToolbarInfo() = 0;
61
62         /// Select the right layout in the combox.
63         virtual void setLayout(docstring const & layout) = 0;
64
65 protected:
66         /// Add a new toolbar. if newline==true, start from a new line
67         virtual void add(ToolbarInfo const & tbinfo, bool newline) = 0;
68         /// Show or hide a toolbar.
69         virtual void displayToolbar(ToolbarInfo const & tbinfo, bool show) = 0;
70         /// Update the state of the icons
71         virtual void updateIcons() = 0;
72
73         // load flags with saved values
74         void initFlags(ToolbarInfo & tbinfo);
75 };
76
77 } // namespace frontend
78 } // namespace lyx
79
80 #endif // NOT TOOLBARS_H