]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mac/carbon/colour.cpp
Rework wxMotif font/color inheritance so it works
[wxWidgets.git] / src / mac / carbon / colour.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/mac/carbon/colour.cpp
3// Purpose: wxColour class
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#include "wx/wxprec.h"
13
14#include "wx/colour.h"
15
16#ifndef WX_PRECOMP
17 #include "wx/gdicmn.h"
18#endif
19
20#include "wx/mac/private.h"
21
22IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
23
24wxColour::wxColour(const RGBColor& col)
25{
26 FromRGBColor((WXCOLORREF *)&col);
27}
28
29static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green )
30{
31 RGBColor* col = (RGBColor*) color;
32 col->red = (red << 8) + red;
33 col->blue = (blue << 8) + blue;
34 col->green = (green << 8) + green;
35}
36
37void wxColour::Init()
38{
39 m_isInit = false;
40 m_red =
41 m_blue =
42 m_green = 0;
43
44 wxComposeRGBColor( &m_pixel, m_red, m_blue, m_green );
45}
46
47wxColour::~wxColour ()
48{
49}
50
51void wxColour::InitRGBA (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
52{
53 m_red = r;
54 m_green = g;
55 m_blue = b;
56 m_alpha = a ;
57 m_isInit = true;
58
59 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green );
60}
61
62void wxColour::FromRGBColor( WXCOLORREF* color )
63{
64 RGBColor* col = (RGBColor*) color;
65 memcpy( &m_pixel, color, 6 );
66 m_red = col->red >> 8;
67 m_blue = col->blue >> 8;
68 m_green = col->green >> 8;
69}
70
71wxColour& wxColour::operator=(const RGBColor& col)
72{
73 FromRGBColor((WXCOLORREF *)&col);
74 return *this;
75}
76
77bool wxColour::IsOk() const
78{
79 return m_isInit;
80}
81