Add missing include, due to André LASSERT change
[lyx.git] / src / ToolbarBackend.h
blob8845b5ddb86ff871a62c97bca3a2335896b067c2
1 // -*- C++ -*-
2 /**
3 * \file ToolbarBackend.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Jean-Marc Lasgouttes
8 * \author John Levon
10 * Full author contact details are available in file CREDITS.
13 #ifndef TOOLBAR_BACKEND_H
14 #define TOOLBAR_BACKEND_H
16 #include "FuncRequest.h"
18 #include <vector>
21 namespace lyx {
24 class Lexer;
26 class ToolbarItem {
27 public:
28 enum Type {
29 /// command/action
30 COMMAND,
31 /// the command buffer
32 MINIBUFFER,
33 /// adds space between buttons in the toolbar
34 SEPARATOR,
35 /// a special combox insead of a button
36 LAYOUTS,
37 /// a special widget to insert tabulars
38 TABLEINSERT,
39 ///
40 POPUPMENU,
41 ///
42 ICONPALETTE
45 ToolbarItem(Type type,
46 FuncRequest const & func,
47 docstring const & label = docstring());
49 ToolbarItem(Type type,
50 std::string const & name = std::string(),
51 docstring const & label = docstring());
53 ~ToolbarItem();
55 /// item type
56 Type type_;
57 /// action
58 FuncRequest func_;
59 /// label/tooltip
60 docstring label_;
61 /// name
62 std::string name_;
66 ///
67 class ToolbarInfo {
68 public:
69 /// toolbar flags
70 enum Flags {
71 ON = 1, //< show
72 OFF = 2, //< do not show
73 MATH = 4, //< show when in math
74 TABLE = 8, //< show when in table
75 TOP = 16, //< show at top
76 BOTTOM = 32, //< show at bottom
77 LEFT = 64, //< show at left
78 RIGHT = 128, //< show at right
79 REVIEW = 256, //< show when change tracking is enabled
80 AUTO = 512, //< only if AUTO is set, when MATH, TABLE and REVIEW is used
81 MATHMACROTEMPLATE = 1024 //< show in math macro template
83 /// the toolbar items
84 typedef std::vector<ToolbarItem> Items;
86 typedef Items::const_iterator item_iterator;
88 explicit ToolbarInfo(std::string const & name = std::string())
89 : name(name) {}
91 /// toolbar name
92 std::string name;
93 /// toolbar GUI name
94 std::string gui_name;
95 /// toolbar contents
96 Items items;
97 /// flags
98 Flags flags;
99 /// store flags when coming to fullscreen mode
100 Flags before_fullscreen;
102 /// read a toolbar from the file
103 ToolbarInfo & read(Lexer &);
105 private:
106 /// add toolbar item
107 void add(ToolbarItem const &);
112 class ToolbarBackend {
113 public:
114 typedef std::vector<ToolbarInfo> Toolbars;
116 ToolbarBackend();
118 /// iterator for all toolbars
119 Toolbars::const_iterator begin() const { return usedtoolbars.begin(); }
121 Toolbars::const_iterator end() const { return usedtoolbars.end(); }
123 Toolbars::iterator begin() { return usedtoolbars.begin(); }
125 Toolbars::iterator end() { return usedtoolbars.end(); }
127 /// read toolbars from the file
128 void readToolbars(Lexer &);
130 /// read ui toolbar settings
131 void readToolbarSettings(Lexer &);
134 ToolbarInfo const * getDefinedToolbarInfo(std::string const & name) const;
136 ToolbarInfo * getUsedToolbarInfo(std::string const & name);
138 // FIXME should be deleted when every window has its own toolbar config.
139 /// number of toggleFullScreen calls, i.e. number of FullScreen windows.
140 int fullScreenWindows;
142 private:
143 /// all the defined toolbars
144 Toolbars toolbars;
146 /// toolbars listed
147 Toolbars usedtoolbars;
150 /// The global instance
151 extern ToolbarBackend toolbarbackend;
155 } // namespace lyx
157 #endif // TOOLBAR_BACKEND_H