2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995-2001 The LyX Team
9 * ======================================================*/
11 #ifndef COLOR_HANDLER_H
12 #define COLOR_HANDLER_H
18 #include <boost/smart_ptr.hpp>
20 // This is only included to provide stuff for the non-public sections
23 #include "PainterBase.h"
28 * This is a factory class that can produce GCs with a specific
29 * color. It will cache GCs for performance.
31 class LyXColorHandler {
38 unsigned long colorPixel(LColor::color c);
40 GC getGCForeground(LColor::color c);
42 GC getGCLinepars(PainterBase::line_style,
43 PainterBase::line_width, LColor::color c);
44 /// update the cache after a color definition change
45 void updateColor(LColor::color c);
53 GC colorGCcache[LColor::ignore + 1];
55 typedef std::map<int, GC> LineGCCache;
57 LineGCCache lineGCcache;
63 extern boost::scoped_ptr<LyXColorHandler> lyxColorHandler;