X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=otk%2Fcolor.hh;h=7fe281b475c2733f2c81e68a8d209d5b522523f0;hb=41e1810c0330786766251368af53758c6d7d16ee;hp=5f3cb95547fa6693ee43385718edaa0902f809aa;hpb=85c41a1aec90b8daefc425596ea34b6f9d0e643c;p=chaz%2Fopenbox diff --git a/otk/color.hh b/otk/color.hh index 5f3cb955..7fe281b4 100644 --- a/otk/color.hh +++ b/otk/color.hh @@ -1,6 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifndef COLOR_HH -#define COLOR_HH +#ifndef __color_hh +#define __color_hh extern "C" { #include @@ -9,16 +9,14 @@ extern "C" { #include #include -class BaseDisplay; +namespace otk { -class BColor { +class Color { public: - BColor(const BaseDisplay * const _display = 0, unsigned int _screen = ~(0u)); - BColor(int _r, int _g, int _b, - const BaseDisplay * const _display, unsigned int _screen = ~(0u)); - BColor(const std::string &_name, - const BaseDisplay * const _display, unsigned int _screen = ~(0u)); - ~BColor(void); + Color(unsigned int _screen = ~(0u)); + Color(int _r, int _g, int _b, unsigned int _screen = ~(0u)); + Color(const std::string &_name, unsigned int _screen = ~(0u)); + ~Color(void); inline const std::string &name(void) const { return colorname; } @@ -32,10 +30,8 @@ public: b = _b; } - inline const BaseDisplay *display(void) const { return dpy; } inline unsigned int screen(void) const { return scrn; } - void setDisplay(const BaseDisplay * const _display, - unsigned int _screen = ~(0u)); + void setScreen(unsigned int _screen = ~(0u)); inline bool isAllocated(void) const { return allocated; } @@ -44,10 +40,12 @@ public: unsigned long pixel(void) const; // operators - BColor &operator=(const BColor &c); - inline bool operator==(const BColor &c) const +#ifndef SWIG + Color &operator=(const Color &c); +#endif + inline bool operator==(const Color &c) const { return (r == c.r && b == c.b && b == c.b); } - inline bool operator!=(const BColor &c) const + inline bool operator!=(const Color &c) const { return (! operator==(c)); } static void cleanupColorCache(void); @@ -60,27 +58,23 @@ private: bool allocated; int r, g, b; unsigned long p; - const BaseDisplay *dpy; unsigned int scrn; std::string colorname; // global color allocator/deallocator struct RGB { - const BaseDisplay* const display; - const unsigned int screen; + const int screen; const int r, g, b; - RGB(void) : display(0), screen(~(0u)), r(-1), g(-1), b(-1) { } - RGB(const BaseDisplay * const a, const unsigned int b, - const int x, const int y, const int z) - : display(a), screen(b), r(x), g(y), b(z) {} + RGB(void) : screen(~(0u)), r(-1), g(-1), b(-1) { } + RGB(const int b, const int x, const int y, const int z) + : screen(b), r(x), g(y), b(z) {} RGB(const RGB &x) - : display(x.display), screen(x.screen), r(x.r), g(x.g), b(x.b) {} + : screen(x.screen), r(x.r), g(x.g), b(x.b) {} inline bool operator==(const RGB &x) const { - return display == x.display && - screen == x.screen && - r == x.r && g == x.g && b == x.b; + return screen == x.screen && + r == x.r && g == x.g && b == x.b; } inline bool operator<(const RGB &x) const { @@ -103,4 +97,6 @@ private: static void doCacheCleanup(void); }; -#endif // COLOR_HH +} + +#endif // __color_hh