]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/ColorHandler.h
remove defaults stuff, let Qt handle no toolbar
[lyx.git] / src / frontends / xforms / ColorHandler.h
1 // -*- C++ -*-
2 /**
3  * \file ColorHandler.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 COLOR_HANDLER_H
13 #define COLOR_HANDLER_H
14
15
16 #include "frontends/Painter.h"
17
18 #include <boost/scoped_ptr.hpp>
19
20 // This is only included to provide stuff for the non-public sections
21 #include <X11/Xlib.h>
22
23 class LyXFont;
24
25 /**
26  * This is a factory class that can produce GCs with a specific
27  * color. It will cache GCs for performance.
28  */
29 class LyXColorHandler {
30 public:
31         ///
32         LyXColorHandler();
33         ///
34         ~LyXColorHandler();
35         ///
36         unsigned long colorPixel(LColor::color c);
37         ///
38         GC getGCForeground(LColor::color c);
39         ///
40         GC getGCLinepars(Painter::line_style,
41                          Painter::line_width, LColor::color c);
42         /// update the cache after a color definition change
43         void updateColor(LColor::color c);
44
45 private:
46         ///
47         Display * display;
48         ///
49         Colormap colormap;
50         ///
51         GC colorGCcache[LColor::ignore + 1];
52         ///
53         typedef std::map<int, GC> LineGCCache;
54         ///
55         LineGCCache lineGCcache;
56         ///
57         Pixmap drawable;
58 };
59
60 ///
61 extern boost::scoped_ptr<LyXColorHandler> lyxColorHandler;
62
63 #endif