]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/ColorCache.h
do what the FIXME suggested
[lyx.git] / src / frontends / qt4 / ColorCache.h
1 // -*- C++ -*-
2 /**
3  * \file ColorCache.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 COLORCACHE_H
13 #define COLORCACHE_H
14
15 #include "ColorCode.h"
16
17 #include <QColor>
18
19 #include <map>
20
21 namespace lyx {
22
23 struct RGBColor;
24
25
26 // FIXME: use a fixed-size array not a map ?
27
28 /**
29  * Cache from Color to QColor.
30  */
31 class ColorCache {
32 public:
33         ColorCache() {}
34
35         /// get the given color
36         QColor const & get(ColorCode color) const;
37
38         /// clear all colors
39         void clear();
40
41 private:
42         typedef std::map<ColorCode, QColor> lcolor_map;
43
44         mutable lcolor_map colormap;
45 };
46
47 ///
48 QColor const rgb2qcolor(RGBColor const &);
49
50 } // namespace lyx
51
52 #endif // COLORCACHE_H