]> git.lyx.org Git - lyx.git/blob - src/ToolbarBackend.h
0819908ee2be04c23a0bddeedae78aa9286ba2b7
[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 unknown
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #ifndef TOOLBAR_BACKEND_H
13 #define TOOLBAR_BACKEND_H
14
15 #include <vector>
16 #include <algorithm>
17
18 #include "LString.h"
19
20 class LyXLex;
21
22 ///
23 class ToolbarBackend {
24 public:
25         /// The special toolbar actions
26         enum  ItemType {
27                 /// adds space between buttons in the toolbar
28                 SEPARATOR = -3,
29                 /// a special combox insead of a button
30                 LAYOUTS = -2,
31                 /// begin a new line of button (not working)
32                 NEWLINE = -1
33         };
34
35         /// action, tooltip
36         typedef std::pair<int, string> Item;
37
38         /// the toolbar items
39         typedef std::vector<std::pair<int, string> > Items;
40
41         typedef Items::iterator iterator;
42
43         typedef Items::const_iterator const_iterator;
44         ///
45         ToolbarBackend();
46         ///
47         iterator begin() {
48                 return items.begin();
49         }
50         ///
51         const_iterator begin() const {
52                 return items.begin();
53         }
54         ///
55         iterator end() {
56                 return items.end();
57         }
58         ///
59         const_iterator end() const {
60                 return items.end();
61         }
62         ///
63         void read(LyXLex &);
64
65         /// return a full path of an XPM for the given action
66         static string const getIcon(int action);
67
68 private:
69         /// add the given lfun with tooltip if relevant
70         void add(int, string const & tooltip = string());
71         /// add the given lfun with tooltip if relevant
72         void add(string const &, string const & tooltip);
73         /// all the items
74         Items items;
75 };
76
77 /// The global instance
78 extern ToolbarBackend toolbarbackend;
79
80
81 #endif // TOOLBAR_BACKEND_H