]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/msw/colour.cpp
*wprintf() functions should be extern, not static, when we define them in wxNEED_WPRI...
[wxWidgets.git] / src / msw / colour.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/msw/colour.cpp
3// Purpose: wxColour class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
16 #pragma hdrstop
17#endif
18
19#include "wx/colour.h"
20
21#ifndef WX_PRECOMP
22 #include "wx/gdicmn.h"
23#endif
24
25#include "wx/msw/private.h"
26
27#include <string.h>
28
29#if wxUSE_EXTENDED_RTTI
30
31template<> void wxStringReadValue(const wxString &s , wxColour &data )
32{
33 if ( !data.Set(s) )
34 {
35 wxLogError(_("String To Colour : Incorrect colour specification : %s"),
36 s.c_str() );
37 data = wxNullColour;
38 }
39}
40
41template<> void wxStringWriteValue(wxString &s , const wxColour &data )
42{
43 s = data.GetAsString(wxC2S_HTML_SYNTAX);
44}
45
46wxTO_STRING_IMP( wxColour )
47wxFROM_STRING_IMP( wxColour )
48
49IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour , wxObject , "wx/colour.h" , &wxTO_STRING( wxColour ) , &wxFROM_STRING( wxColour ))
50
51wxBEGIN_PROPERTIES_TABLE(wxColour)
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"))
55wxEND_PROPERTIES_TABLE()
56
57wxDIRECT_CONSTRUCTOR_3( wxColour, unsigned char, Red, unsigned char, Green, unsigned char, Blue )
58
59wxBEGIN_HANDLERS_TABLE(wxColour)
60wxEND_HANDLERS_TABLE()
61#else
62IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
63#endif
64
65// Colour
66
67void wxColour::Init()
68{
69 m_isInit = false;
70 m_pixel = 0;
71 m_alpha =
72 m_red =
73 m_blue =
74 m_green = 0;
75}
76
77wxColour::~wxColour()
78{
79}
80
81void wxColour::InitRGBA(unsigned char r, unsigned char g, unsigned char b,
82 unsigned char a)
83{
84 m_red = r;
85 m_green = g;
86 m_blue = b;
87 m_alpha = a;
88 m_isInit = true;
89 m_pixel = PALETTERGB(m_red, m_green, m_blue);
90}