]> git.saurik.com Git - wxWidgets.git/blame - src/mac/classic/colour.cpp
fix gcc warnings about in printf format (partly modified patch 1500717)
[wxWidgets.git] / src / mac / classic / colour.cpp
CommitLineData
2646f485 1/////////////////////////////////////////////////////////////////////////////
edc536d3 2// Name: src/mac/classic/colour.cpp
2646f485
SC
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
edc536d3 9// Licence: wxWindows licence
2646f485
SC
10/////////////////////////////////////////////////////////////////////////////
11
40989e46
WS
12#include "wx/wxprec.h"
13
2646f485
SC
14#include "wx/colour.h"
15
dd05139a
WS
16#ifndef WX_PRECOMP
17 #include "wx/gdicmn.h"
18#endif
40989e46 19
2646f485 20IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
2646f485
SC
21
22// Colour
23
24#include "wx/mac/private.h"
25
26static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green ) ;
27static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green )
28{
29 RGBColor* col = (RGBColor*) color ;
30 col->red = (red << 8) + red;
31 col->blue = (blue << 8) + blue;
32 col->green = (green << 8) + green;
33}
34
35void wxColour::Init()
36{
37 m_isInit = false;
38 m_red =
39 m_blue =
40 m_green = 0;
41
42 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
43}
44
45wxColour::wxColour (const wxColour& col)
46 : wxObject()
47{
48 m_red = col.m_red;
49 m_green = col.m_green;
50 m_blue = col.m_blue;
51 m_isInit = col.m_isInit;
52
53 memcpy( &m_pixel , &col.m_pixel , 6 ) ;
54}
55
56wxColour::wxColour (const wxColour* col)
57{
58 m_red = col->m_red;
59 m_green = col->m_green;
60 m_blue = col->m_blue;
61 m_isInit = col->m_isInit;
62
63 memcpy( &m_pixel , &col->m_pixel , 6 ) ;
64}
65
66wxColour& wxColour::operator =(const wxColour& col)
67{
68 m_red = col.m_red;
69 m_green = col.m_green;
70 m_blue = col.m_blue;
71 m_isInit = col.m_isInit;
72
73 memcpy( &m_pixel , &col.m_pixel , 6 ) ;
74
75 return *this;
76}
77
2646f485
SC
78wxColour::~wxColour ()
79{
80}
81
40989e46 82void wxColour::InitWith (unsigned char r, unsigned char g, unsigned char b)
2646f485
SC
83{
84 m_red = r;
85 m_green = g;
86 m_blue = b;
87 m_isInit = true;
88
89 wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
90}
91
92void wxColour::Set( const WXCOLORREF* color )
93{
94 RGBColor* col = (RGBColor*) color ;
95 memcpy( &m_pixel , color , 6 ) ;
96 m_red = col->red>>8 ;
97 m_blue = col->blue>>8 ;
98 m_green = col->green>>8 ;
99}