]> git.saurik.com Git - wxWidgets.git/blame - src/mac/colour.cpp
BC++ 5 does not have Unicode version of GetProcAddress.
[wxWidgets.git] / src / mac / colour.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: colour.cpp
3// Purpose: wxColour class
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "colour.h"
14#endif
15
16#include "wx/gdicmn.h"
17#include "wx/colour.h"
18
e9576ca5 19IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
e9576ca5
SC
20
21// Colour
22
519cb848
SC
23static void wxComposeRGBColor( RGBColor * col , int red, int blue, int green ) ;
24static void wxComposeRGBColor( RGBColor * col , int red, int blue, int green )
25{
26 col->red = (red << 8) + red;
27 col->blue = (blue << 8) + blue;
28 col->green = (green << 8) + green;
29}
30
e9576ca5
SC
31wxColour::wxColour ()
32{
519cb848
SC
33 m_isInit = FALSE;
34 m_red = m_blue = m_green = 0;
35
36 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
e9576ca5
SC
37}
38
39wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
40{
41 m_red = r;
42 m_green = g;
43 m_blue = b;
44 m_isInit = TRUE;
519cb848
SC
45
46 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
e9576ca5
SC
47}
48
49wxColour::wxColour (const wxColour& col)
50{
51 m_red = col.m_red;
52 m_green = col.m_green;
53 m_blue = col.m_blue;
54 m_isInit = col.m_isInit;
519cb848 55
e9576ca5 56 m_pixel = col.m_pixel;
519cb848
SC
57}
58
59wxColour::wxColour (const wxColour* col)
60{
61 m_red = col->m_red;
62 m_green = col->m_green;
63 m_blue = col->m_blue;
64 m_isInit = col->m_isInit;
65
66 m_pixel = col->m_pixel;
e9576ca5
SC
67}
68
69wxColour& wxColour::operator =(const wxColour& col)
70{
71 m_red = col.m_red;
72 m_green = col.m_green;
73 m_blue = col.m_blue;
74 m_isInit = col.m_isInit;
519cb848 75
e9576ca5 76 m_pixel = col.m_pixel;
519cb848 77
e9576ca5
SC
78 return *this;
79}
80
81void wxColour::InitFromName(const wxString& col)
82{
83 wxColour *the_colour = wxTheColourDatabase->FindColour (col);
84 if (the_colour)
85 {
86 m_red = the_colour->Red ();
87 m_green = the_colour->Green ();
88 m_blue = the_colour->Blue ();
89 m_isInit = TRUE;
90 }
91 else
92 {
93 m_red = 0;
94 m_green = 0;
95 m_blue = 0;
96 m_isInit = FALSE;
97 }
519cb848
SC
98
99 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
e9576ca5
SC
100}
101
102wxColour::~wxColour ()
103{
104}
105
106void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
107{
108 m_red = r;
109 m_green = g;
110 m_blue = b;
111 m_isInit = TRUE;
519cb848
SC
112
113 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
e9576ca5 114}