aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Color.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-11-26 16:01:28 (GMT)
committerfluxgen <fluxgen>2002-11-26 16:01:28 (GMT)
commitac4420cdc50b7d7410781bc1bbbd1e89e18f256d (patch)
tree5c18c5497d42fafdd962269aa42f2efe80a2afdf /src/FbTk/Color.hh
parent031edc36acb3957046d0836ec0ac17cd1c323b22 (diff)
downloadfluxbox_pavel-ac4420cdc50b7d7410781bc1bbbd1e89e18f256d.zip
fluxbox_pavel-ac4420cdc50b7d7410781bc1bbbd1e89e18f256d.tar.bz2
initial import
Diffstat (limited to 'src/FbTk/Color.hh')
-rw-r--r--src/FbTk/Color.hh73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/FbTk/Color.hh b/src/FbTk/Color.hh
new file mode 100644
index 0000000..07d7f55
--- /dev/null
+++ b/src/FbTk/Color.hh
@@ -0,0 +1,73 @@
1// Color.hh for Fluxbox Window Manager
2// Copyright (c) 2002 Henrik Kinnunen (fluxgen@users.sourceforge.net)
3//
4// from Image.hh for Blackbox - an X11 Window manager
5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
6//
7// Permission is hereby granted, free of charge, to any person obtaining a
8// copy of this software and associated documentation files (the "Software"),
9// to deal in the Software without restriction, including without limitation
10// the rights to use, copy, modify, merge, publish, distribute, sublicense,
11// and/or sell copies of the Software, and to permit persons to whom the
12// Software is furnished to do so, subject to the following conditions:
13//
14// The above copyright notice and this permission notice shall be included in
15// all copies or substantial portions of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE.
24
25// $Id: Color.hh,v 1.1 2002/11/26 16:01:27 fluxgen Exp $
26
27#ifndef FBTK_COLOR_HH
28#define FBTK_COLOR_HH
29
30#include "NotCopyable.hh"
31
32namespace FbTk {
33/**
34 Holds rgb color and pixel value
35*/
36class Color {
37public:
38 Color();
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();
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 // TODO
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
57private:
58 void free();
59 void copy(const Color &col);
60 void allocate(unsigned char red, unsigned char green, unsigned char blue, int screen);
61 inline void setAllocated(bool a) { m_allocated = a; }
62 void setRGB(unsigned char red, unsigned char green, unsigned char blue);
63
64
65 unsigned char m_red, m_green, m_blue;
66 unsigned long m_pixel;
67 bool m_allocated;
68 int m_screen;
69};
70
71}; // end namespace FbTk
72
73#endif // FBTK_COLOR_HH