diff options
author | fluxgen <fluxgen> | 2002-09-14 13:49:09 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-09-14 13:49:09 (GMT) |
commit | 60bc660aa5200e6b5952b75a56299247efe0f14d (patch) | |
tree | 69184826202e18faeb297a698da6987a126b1d56 /src | |
parent | fbcbb7a3c1fdd9763f0abb775b43a61374280a31 (diff) | |
download | fluxbox-60bc660aa5200e6b5952b75a56299247efe0f14d.zip fluxbox-60bc660aa5200e6b5952b75a56299247efe0f14d.tar.bz2 |
minor fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/Color.hh | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/src/Color.hh b/src/Color.hh index 9c457eb..bec7cc9 100644 --- a/src/Color.hh +++ b/src/Color.hh | |||
@@ -1,5 +1,5 @@ | |||
1 | // Color.hh for Fluxbox Window Manager | 1 | // Color.hh for Fluxbox Window Manager |
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxbox@linuxmail.org) | 2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen@users.sourceforge.net) |
3 | // | 3 | // |
4 | // from Image.hh for Blackbox - an X11 Window manager | 4 | // from Image.hh for Blackbox - an X11 Window manager |
5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | 5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) |
@@ -22,36 +22,50 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Color.hh,v 1.1 2002/07/23 16:23:15 fluxgen Exp $ | 25 | // $Id: Color.hh,v 1.2 2002/09/14 13:49:09 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef FBTK_COLOR_HH | 27 | #ifndef FBTK_COLOR_HH |
28 | #define FBTK_COLOR_HH | 28 | #define FBTK_COLOR_HH |
29 | 29 | ||
30 | #include "NotCopyable.hh" | ||
31 | |||
30 | namespace FbTk { | 32 | namespace FbTk { |
31 | /** | 33 | /** |
32 | Holds rgb color and pixel value | 34 | Holds rgb color and pixel value |
33 | */ | 35 | */ |
34 | class Color { | 36 | class Color { |
35 | public: | 37 | public: |
36 | Color(unsigned char red = 0, unsigned char green = 0, unsigned char blue = 0): | 38 | Color(); |
37 | m_red(red), m_green(green), m_blue(blue), m_pixel(0), m_allocated(false) { } | 39 | explicit Color(unsigned long pixel); |
40 | Color(const Color &col_copy); | ||
41 | Color(unsigned char red, unsigned char green, unsigned char blue, int screen); | ||
42 | Color(const char *color_string, int screen); | ||
43 | ~Color(); | ||
38 | 44 | ||
45 | bool setFromString(const char *color_string, int screen); | ||
46 | /// TODO don't like this | ||
47 | void setPixel(unsigned long pixel) { m_pixel = pixel; } | ||
48 | |||
49 | Color &operator = (const Color &col_copy); | ||
50 | |||
51 | bool isAllocated() const { return m_allocated; } | ||
52 | unsigned char red() const { return m_red; } | ||
53 | unsigned char green() const { return m_green; } | ||
54 | unsigned char blue() const { return m_blue; } | ||
55 | unsigned long pixel() const { return m_pixel; } | ||
56 | |||
57 | private: | ||
58 | void free(); | ||
59 | void copy(const Color &col); | ||
60 | void allocate(unsigned char red, unsigned char green, unsigned char blue, int screen); | ||
39 | inline void setAllocated(bool a) { m_allocated = a; } | 61 | inline void setAllocated(bool a) { m_allocated = a; } |
40 | inline void setRGB(char red, char green, char blue) { m_red = red; m_green = green; m_blue = blue; } | 62 | void setRGB(unsigned char red, unsigned char green, unsigned char blue); |
41 | inline void setPixel(unsigned long pixel) { m_pixel = pixel; } | ||
42 | |||
43 | inline bool isAllocated() const { return m_allocated; } | ||
44 | 63 | ||
45 | inline unsigned char red() const { return m_red; } | ||
46 | inline unsigned char green() const { return m_green; } | ||
47 | inline unsigned char blue() const { return m_blue; } | ||
48 | 64 | ||
49 | inline unsigned long pixel() const { return m_pixel; } | ||
50 | |||
51 | private: | ||
52 | unsigned char m_red, m_green, m_blue; | 65 | unsigned char m_red, m_green, m_blue; |
53 | unsigned long m_pixel; | 66 | unsigned long m_pixel; |
54 | bool m_allocated; | 67 | bool m_allocated; |
68 | int m_screen; | ||
55 | }; | 69 | }; |
56 | 70 | ||
57 | }; // end namespace FbTk | 71 | }; // end namespace FbTk |