1 #ifndef __color_mapper_h 2 #define __color_mapper_h 3 4 class ColorMapper { 5 public: 6 ColorMapper(Display *dpy); 7 ~ColorMapper(); 8 9 unsigned long alloc_color( XColor *col ); 10 unsigned long alloc_named_color( const char *name ); get_colormap()11 Colormap get_colormap() { return mymap; } 12 GetDisplay()13 Display *GetDisplay() { return dpy; } 14 15 private: 16 void setup_usage(); 17 void free_usage(); 18 19 Display *dpy; 20 Colormap mymap; 21 int cells; 22 XColor *colors; 23 }; 24 25 class Port { 26 public: 27 Port(Display *dpy); 28 ~Port(); 29 GetDisplay()30 Display *GetDisplay() { return dpy; } GetMapper()31 ColorMapper *GetMapper() { return mapper; } 32 AllocNamedColor(const char * name)33 unsigned long AllocNamedColor( const char *name ) 34 { return mapper->alloc_named_color( name ); } 35 36 private: 37 Display *dpy; 38 ColorMapper *mapper; 39 }; 40 #endif 41