]> git.saurik.com Git - wxWidgets.git/blob - src/mac/colour.cpp
Added WIN16 code for window disabler
[wxWidgets.git] / src / mac / colour.cpp
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
19 IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
20
21 // Colour
22
23 static void wxComposeRGBColor( RGBColor * col , int red, int blue, int green ) ;
24 static 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
31 wxColour::wxColour ()
32 {
33 m_isInit = FALSE;
34 m_red = m_blue = m_green = 0;
35
36 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
37 }
38
39 wxColour::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;
45
46 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
47 }
48
49 wxColour::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;
55
56 m_pixel = col.m_pixel;
57 }
58
59 wxColour::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;
67 }
68
69 wxColour& 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;
75
76 m_pixel = col.m_pixel;
77
78 return *this;
79 }
80
81 void 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 }
98
99 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
100 }
101
102 wxColour::~wxColour ()
103 {
104 }
105
106 void 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;
112
113 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
114 }