]> git.lyx.org Git - lyx.git/blob - src/ToolbarBackend.h
remove unneeded functions
[lyx.git] / src / ToolbarBackend.h
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.
6  *
7  * \author Jean-Marc Lasgouttes
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef TOOLBAR_BACKEND_H
14 #define TOOLBAR_BACKEND_H
15
16 #include "funcrequest.h"
17
18 #include <vector>
19
20
21 class LyXLex;
22
23
24 ///
25 class ToolbarBackend {
26 public:
27         /// The special toolbar actions
28         enum ItemType {
29                 /// the command buffer
30                 MINIBUFFER = -3,
31                 /// adds space between buttons in the toolbar
32                 SEPARATOR = -2,
33                 /// a special combox insead of a button
34                 LAYOUTS = -1,
35         };
36
37         /// action, tooltip
38         typedef std::pair<FuncRequest, std::string> Item;
39
40         /// the toolbar items
41         typedef std::vector<Item> Items;
42
43         /// toolbar flags
44         enum Flags {
45                 ON = 1, //< always shown
46                 OFF = 2, //< never shown
47                 MATH = 4, //< shown when in math
48                 TABLE = 8, //< shown when in table
49                 TOP = 16, //< show at top
50                 BOTTOM = 32, //< show at bottom
51                 LEFT = 64, //< show at left
52                 RIGHT = 128 //< show at right
53         };
54
55         /// a toolbar
56         struct Toolbar {
57                 /// toolbar name
58                 std::string name;
59                 /// toolbar GUI name
60                 std::string gui_name;
61                 /// toolbar contents
62                 Items items;
63                 /// flags
64                 Flags flags;
65         };
66
67         typedef std::vector<Toolbar> Toolbars;
68
69         typedef Items::const_iterator item_iterator;
70
71         ToolbarBackend();
72
73         /// iterator for all toolbars
74         Toolbars::const_iterator begin() const {
75                 return usedtoolbars.begin();
76         }
77
78         Toolbars::const_iterator end() const {
79                 return usedtoolbars.end();
80         }
81
82         /// read a toolbar from the file
83         void read(LyXLex &);
84
85         /// read the used toolbars
86         void readToolbars(LyXLex &);
87
88         /// return a full path of an XPM for the given action
89         static std::string const getIcon(FuncRequest const &);
90
91 private:
92         /// add the given lfun with tooltip if relevant
93         void add(Toolbar & tb, FuncRequest const &,
94                  std::string const & tooltip = std::string());
95
96         /// all the toolbars
97         Toolbars toolbars;
98
99         /// toolbars listed
100         Toolbars usedtoolbars;
101 };
102
103 /// The global instance
104 extern ToolbarBackend toolbarbackend;
105
106
107 #endif // TOOLBAR_BACKEND_H