]> icculus.org git repositories - mikachu/openbox.git/blob - otk/rendercolor.hh
add most of our style elements
[mikachu/openbox.git] / otk / rendercolor.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __rendercolor_hh
3 #define __rendercolor_hh
4
5 extern "C" {
6 #include <X11/Xlib.h>
7 }
8
9 #include <map>
10
11 namespace otk {
12
13 class RenderColor {
14   struct CacheItem {
15     GC gc;
16     int count;
17     CacheItem(GC g) : gc(g), count(0) {}
18   };
19   static std::map<unsigned long, CacheItem*> *_cache;
20
21   int _screen;
22   unsigned char _red;
23   unsigned char _green;
24   unsigned char _blue;
25
26   GC _gc;
27
28 public:
29   static void initialize();
30   static void destroy();
31   
32   RenderColor(int screen, unsigned char red,
33               unsigned char green, unsigned char blue);
34   virtual ~RenderColor();
35
36   inline int screen() const { return _screen; }
37   inline unsigned char red() const { return _red; }
38   inline unsigned char green() const { return _green; }
39   inline unsigned char blue() const { return _blue; }
40   inline GC gc() const { return _gc; }
41 };
42
43 }
44
45 #endif // __rendercolor_hh