minor fixes
This commit is contained in:
parent
fbcbb7a3c1
commit
60bc660aa5
1 changed files with 30 additions and 16 deletions
40
src/Color.hh
40
src/Color.hh
|
@ -1,5 +1,5 @@
|
||||||
// Color.hh for Fluxbox Window Manager
|
// Color.hh for Fluxbox Window Manager
|
||||||
// Copyright (c) 2002 Henrik Kinnunen (fluxbox@linuxmail.org)
|
// Copyright (c) 2002 Henrik Kinnunen (fluxgen@users.sourceforge.net)
|
||||||
//
|
//
|
||||||
// from Image.hh for Blackbox - an X11 Window manager
|
// from Image.hh for Blackbox - an X11 Window manager
|
||||||
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
|
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
|
||||||
|
@ -22,36 +22,50 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Color.hh,v 1.1 2002/07/23 16:23:15 fluxgen Exp $
|
// $Id: Color.hh,v 1.2 2002/09/14 13:49:09 fluxgen Exp $
|
||||||
|
|
||||||
#ifndef FBTK_COLOR_HH
|
#ifndef FBTK_COLOR_HH
|
||||||
#define FBTK_COLOR_HH
|
#define FBTK_COLOR_HH
|
||||||
|
|
||||||
|
#include "NotCopyable.hh"
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
/**
|
/**
|
||||||
Holds rgb color and pixel value
|
Holds rgb color and pixel value
|
||||||
*/
|
*/
|
||||||
class Color {
|
class Color {
|
||||||
public:
|
public:
|
||||||
Color(unsigned char red = 0, unsigned char green = 0, unsigned char blue = 0):
|
Color();
|
||||||
m_red(red), m_green(green), m_blue(blue), m_pixel(0), m_allocated(false) { }
|
explicit Color(unsigned long pixel);
|
||||||
|
Color(const Color &col_copy);
|
||||||
|
Color(unsigned char red, unsigned char green, unsigned char blue, int screen);
|
||||||
|
Color(const char *color_string, int screen);
|
||||||
|
~Color();
|
||||||
|
|
||||||
inline void setAllocated(bool a) { m_allocated = a; }
|
bool setFromString(const char *color_string, int screen);
|
||||||
inline void setRGB(char red, char green, char blue) { m_red = red; m_green = green; m_blue = blue; }
|
/// TODO don't like this
|
||||||
inline void setPixel(unsigned long pixel) { m_pixel = pixel; }
|
void setPixel(unsigned long pixel) { m_pixel = pixel; }
|
||||||
|
|
||||||
inline bool isAllocated() const { return m_allocated; }
|
Color &operator = (const Color &col_copy);
|
||||||
|
|
||||||
inline unsigned char red() const { return m_red; }
|
bool isAllocated() const { return m_allocated; }
|
||||||
inline unsigned char green() const { return m_green; }
|
unsigned char red() const { return m_red; }
|
||||||
inline unsigned char blue() const { return m_blue; }
|
unsigned char green() const { return m_green; }
|
||||||
|
unsigned char blue() const { return m_blue; }
|
||||||
inline unsigned long pixel() const { return m_pixel; }
|
unsigned long pixel() const { return m_pixel; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void free();
|
||||||
|
void copy(const Color &col);
|
||||||
|
void allocate(unsigned char red, unsigned char green, unsigned char blue, int screen);
|
||||||
|
inline void setAllocated(bool a) { m_allocated = a; }
|
||||||
|
void setRGB(unsigned char red, unsigned char green, unsigned char blue);
|
||||||
|
|
||||||
|
|
||||||
unsigned char m_red, m_green, m_blue;
|
unsigned char m_red, m_green, m_blue;
|
||||||
unsigned long m_pixel;
|
unsigned long m_pixel;
|
||||||
bool m_allocated;
|
bool m_allocated;
|
||||||
|
int m_screen;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // end namespace FbTk
|
}; // end namespace FbTk
|
||||||
|
|
Loading…
Reference in a new issue