]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/colour.cpp
Fixing SetColumnWidth and selection handling, attempt at fixing ClearAll(), and initi...
[wxWidgets.git] / src / mac / carbon / colour.cpp
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
22 IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
23
24 static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green );
25 static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green )
26 {
27 RGBColor* col = (RGBColor*) color;
28 col->red = (red << 8) + red;
29 col->blue = (blue << 8) + blue;
30 col->green = (green << 8) + green;
31 }
32
33 void wxColour::Init()
34 {
35 m_isInit = false;
36 m_red =
37 m_blue =
38 m_green = 0;
39
40 wxComposeRGBColor( &m_pixel, m_red, m_blue, m_green );
41 }
42
43 wxColour::~wxColour ()
44 {
45 }
46
47 void wxColour::InitRGBA (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
48 {
49 m_red = r;
50 m_green = g;
51 m_blue = b;
52 m_alpha = a ;
53 m_isInit = true;
54
55 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green );
56 }
57
58 void wxColour::FromRGBColor( const WXCOLORREF* color )
59 {
60 RGBColor* col = (RGBColor*) color;
61 memcpy( &m_pixel, color, 6 );
62 m_red = col->red >> 8;
63 m_blue = col->blue >> 8;
64 m_green = col->green >> 8;
65 }