diff options
author | fluxgen <fluxgen> | 2002-09-20 13:02:40 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-09-20 13:02:40 (GMT) |
commit | 3e0d0de6d9de39981ea0fd624a3d506f20670cb3 (patch) | |
tree | 39b578193cc2b4417de475204147b91d6df7788d /src | |
parent | 14d355e65826398ac3cb5ac1f1d97bfbeceabe27 (diff) | |
download | fluxbox_lack-3e0d0de6d9de39981ea0fd624a3d506f20670cb3.zip fluxbox_lack-3e0d0de6d9de39981ea0fd624a3d506f20670cb3.tar.bz2 |
removed assignment operator
Diffstat (limited to 'src')
-rw-r--r-- | src/Color.cc | 21 | ||||
-rw-r--r-- | src/Color.hh | 6 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/Color.cc b/src/Color.cc index d8b75b2..e848def 100644 --- a/src/Color.cc +++ b/src/Color.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: Color.cc,v 1.2 2002/09/14 13:49:51 fluxgen Exp $ | 22 | // $Id: Color.cc,v 1.3 2002/09/20 13:02:39 fluxgen Exp $ |
23 | 23 | ||
24 | #include "Color.hh" | 24 | #include "Color.hh" |
25 | 25 | ||
@@ -57,7 +57,8 @@ m_screen(screen) { | |||
57 | } | 57 | } |
58 | 58 | ||
59 | Color::Color(const char *color_string, int screen): | 59 | Color::Color(const char *color_string, int screen): |
60 | m_allocated(false) { | 60 | m_allocated(false), |
61 | m_screen(screen) { | ||
61 | setFromString(color_string, screen); | 62 | setFromString(color_string, screen); |
62 | } | 63 | } |
63 | 64 | ||
@@ -94,10 +95,16 @@ bool Color::setFromString(const char *color_string, int screen) { | |||
94 | return true; | 95 | return true; |
95 | } | 96 | } |
96 | 97 | ||
98 | /* | ||
97 | Color &Color::Color::operator = (const Color &col_copy) { | 99 | Color &Color::Color::operator = (const Color &col_copy) { |
100 | // check for aliasing | ||
101 | if (this == &col_copy) | ||
102 | return *this; | ||
103 | |||
98 | copy(col_copy); | 104 | copy(col_copy); |
99 | return *this; | 105 | return *this; |
100 | } | 106 | } |
107 | */ | ||
101 | 108 | ||
102 | void Color::free() { | 109 | void Color::free() { |
103 | if (isAllocated()) { | 110 | if (isAllocated()) { |
@@ -113,9 +120,11 @@ void Color::free() { | |||
113 | void Color::copy(const Color &col_copy) { | 120 | void Color::copy(const Color &col_copy) { |
114 | if (!col_copy.isAllocated()) { | 121 | if (!col_copy.isAllocated()) { |
115 | free(); | 122 | free(); |
123 | setRGB(col_copy.red(), col_copy.green(), col_copy.blue()); | ||
124 | setPixel(col_copy.pixel()); | ||
116 | return; | 125 | return; |
117 | } | 126 | } |
118 | 127 | ||
119 | free(); | 128 | free(); |
120 | 129 | ||
121 | allocate(col_copy.red(), | 130 | allocate(col_copy.red(), |
@@ -131,8 +140,9 @@ void Color::allocate(unsigned char red, unsigned char green, unsigned char blue, | |||
131 | XColor color; | 140 | XColor color; |
132 | // fill xcolor structure | 141 | // fill xcolor structure |
133 | color.red = red; | 142 | color.red = red; |
143 | color.green = green; | ||
134 | color.blue = blue; | 144 | color.blue = blue; |
135 | color.green = green; | 145 | |
136 | 146 | ||
137 | if (!XAllocColor(disp, DefaultColormap(disp, screen), &color)) { | 147 | if (!XAllocColor(disp, DefaultColormap(disp, screen), &color)) { |
138 | cerr<<"FbTk::Color: Allocation error."<<endl; | 148 | cerr<<"FbTk::Color: Allocation error."<<endl; |
@@ -143,6 +153,8 @@ void Color::allocate(unsigned char red, unsigned char green, unsigned char blue, | |||
143 | setPixel(color.pixel); | 153 | setPixel(color.pixel); |
144 | setAllocated(true); | 154 | setAllocated(true); |
145 | } | 155 | } |
156 | |||
157 | m_screen = screen; | ||
146 | } | 158 | } |
147 | 159 | ||
148 | void Color::setRGB(unsigned char red, unsigned char green, unsigned char blue) { | 160 | void Color::setRGB(unsigned char red, unsigned char green, unsigned char blue) { |
@@ -150,4 +162,5 @@ void Color::setRGB(unsigned char red, unsigned char green, unsigned char blue) { | |||
150 | m_green = green; | 162 | m_green = green; |
151 | m_blue = blue; | 163 | m_blue = blue; |
152 | } | 164 | } |
165 | |||
153 | }; | 166 | }; |
diff --git a/src/Color.hh b/src/Color.hh index bec7cc9..b26c575 100644 --- a/src/Color.hh +++ b/src/Color.hh | |||
@@ -22,7 +22,7 @@ | |||
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.2 2002/09/14 13:49:09 fluxgen Exp $ | 25 | // $Id: Color.hh,v 1.3 2002/09/20 13:02:40 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef FBTK_COLOR_HH | 27 | #ifndef FBTK_COLOR_HH |
28 | #define FBTK_COLOR_HH | 28 | #define FBTK_COLOR_HH |
@@ -45,8 +45,8 @@ public: | |||
45 | bool setFromString(const char *color_string, int screen); | 45 | bool setFromString(const char *color_string, int screen); |
46 | /// TODO don't like this | 46 | /// TODO don't like this |
47 | void setPixel(unsigned long pixel) { m_pixel = pixel; } | 47 | void setPixel(unsigned long pixel) { m_pixel = pixel; } |
48 | 48 | // TODO | |
49 | Color &operator = (const Color &col_copy); | 49 | //Color &operator = (const Color &col_copy); |
50 | 50 | ||
51 | bool isAllocated() const { return m_allocated; } | 51 | bool isAllocated() const { return m_allocated; } |
52 | unsigned char red() const { return m_red; } | 52 | unsigned char red() const { return m_red; } |