]> git.lyx.org Git - features.git/blob - src/frontends/qt2/lcolorcache.h
05e045610f9c3de5fb9db003b3cc2155aec90c17
[features.git] / src / frontends / qt2 / lcolorcache.h
1 // -*- C++ -*-
2 /**
3  * \file lcolorcache.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef LCOLORCACHE_H
13 #define LCOLORCACHE_H
14
15 #include <map>
16
17 #include "LColor.h"
18
19 #include <qcolor.h>
20
21 // FIXME: use a fixed-size array not a map ?
22
23 /**
24  * Cache from LColor to QColor.
25  */
26 class LColorCache {
27 public:
28         LColorCache();
29
30         /// get the given color
31         QColor const & get(LColor::color color) const;
32
33         /// clear all colors
34         void clear();
35
36 private:
37         typedef std::map<LColor::color, QColor> lcolor_map;
38
39         mutable lcolor_map colormap;
40 };
41
42 /// singleton instance
43 extern LColorCache lcolorcache;
44
45 #endif // LCOLORCACHE_H