]> git.saurik.com Git - wxWidgets.git/blame - src/msw/colour.cpp
check that the version of __sync_sub_and_fetch that returns a value is supported...
[wxWidgets.git] / src / msw / colour.cpp
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
edc536d3 2// Name: src/msw/colour.cpp
2bda0e17
KB
3// Purpose: wxColour class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
6c9a19aa 8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
2bda0e17
KB
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
40989e46 16 #pragma hdrstop
2bda0e17
KB
17#endif
18
7cf41a5d
WS
19#include "wx/colour.h"
20
dd05139a
WS
21#ifndef WX_PRECOMP
22 #include "wx/gdicmn.h"
23#endif
24
8cb172b4 25#include "wx/msw/private.h"
2bda0e17
KB
26
27#include <string.h>
2bda0e17 28
066f1b7a 29#if wxUSE_EXTENDED_RTTI
067e9be6 30
067e9be6
SC
31template<> void wxStringReadValue(const wxString &s , wxColour &data )
32{
40989e46 33 if ( !data.Set(s) )
067e9be6 34 {
aad6765c
JS
35 wxLogError(_("String To Colour : Incorrect colour specification : %s"),
36 s.c_str() );
067e9be6
SC
37 data = wxNullColour;
38 }
067e9be6
SC
39}
40
41template<> void wxStringWriteValue(wxString &s , const wxColour &data )
42{
40989e46 43 s = data.GetAsString(wxC2S_HTML_SYNTAX);
067e9be6
SC
44}
45
af498247
VZ
46wxTO_STRING_IMP( wxColour )
47wxFROM_STRING_IMP( wxColour )
02b7b6b0 48
af498247 49IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour , wxObject , "wx/colour.h" , &wxTO_STRING( wxColour ) , &wxFROM_STRING( wxColour ))
066f1b7a 50
3ff066a4 51wxBEGIN_PROPERTIES_TABLE(wxColour)
af498247
VZ
52 wxREADONLY_PROPERTY( Red, unsigned char, Red, EMPTY_MACROVALUE , 0 /*flags*/, wxT("Helpstring"), wxT("group"))
53 wxREADONLY_PROPERTY( Green, unsigned char, Green, EMPTY_MACROVALUE , 0 /*flags*/, wxT("Helpstring"), wxT("group"))
54 wxREADONLY_PROPERTY( Blue, unsigned char, Blue, EMPTY_MACROVALUE , 0 /*flags*/, wxT("Helpstring"), wxT("group"))
3ff066a4 55wxEND_PROPERTIES_TABLE()
066f1b7a 56
8e952859 57wxDIRECT_CONSTRUCTOR_3( wxColour, unsigned char, Red, unsigned char, Green, unsigned char, Blue )
066f1b7a 58
3ff066a4
SC
59wxBEGIN_HANDLERS_TABLE(wxColour)
60wxEND_HANDLERS_TABLE()
066f1b7a 61#else
2bda0e17 62IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
066f1b7a 63#endif
2bda0e17
KB
64
65// Colour
66
f75aecd0 67void wxColour::Init()
2bda0e17 68{
aad6765c 69 m_isInit = false;
f75aecd0 70 m_pixel = 0;
c2b9ae5f 71 m_alpha =
f75aecd0
VZ
72 m_red =
73 m_blue =
74 m_green = 0;
2bda0e17
KB
75}
76
68dda785 77wxColour::~wxColour()
2bda0e17
KB
78{
79}
80
aea95b1c 81void wxColour::InitRGBA(unsigned char r, unsigned char g, unsigned char b,
c2b9ae5f 82 unsigned char a)
2bda0e17 83{
f75aecd0
VZ
84 m_red = r;
85 m_green = g;
86 m_blue = b;
c2b9ae5f 87 m_alpha = a;
aad6765c
JS
88 m_isInit = true;
89 m_pixel = PALETTERGB(m_red, m_green, m_blue);
2bda0e17 90}