]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/ColorCache.h
enable Font cache only for MacOSX and inline width() for other platform.
[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 "LColor.h"
16
17 #include <QColor>
18
19 #include <map>
20
21 namespace lyx {
22 struct RGBColor;
23 }
24
25
26 // FIXME: use a fixed-size array not a map ?
27
28 /**
29  * Cache from LColor to QColor.
30  */
31 class ColorCache {
32 public:
33         ColorCache();
34
35         /// get the given color
36         QColor const & get(LColor_color color) const;
37
38         /// clear all colors
39         void clear();
40
41 private:
42         typedef std::map<LColor_color, QColor> lcolor_map;
43
44         mutable lcolor_map colormap;
45 };
46
47 ///
48 QColor const rgb2qcolor(lyx::RGBColor const &);
49 #endif // COLORCACHE_H