]>
Commit | Line | Data |
---|---|---|
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 | ||
40989e46 WS |
15 | #include "wx/colour.h" |
16 | ||
2bda0e17 | 17 | #ifdef __BORLANDC__ |
40989e46 | 18 | #pragma hdrstop |
2bda0e17 KB |
19 | #endif |
20 | ||
21 | #include "wx/gdicmn.h" | |
8cb172b4 | 22 | #include "wx/msw/private.h" |
2bda0e17 KB |
23 | |
24 | #include <string.h> | |
2bda0e17 | 25 | |
066f1b7a | 26 | #if wxUSE_EXTENDED_RTTI |
067e9be6 | 27 | |
067e9be6 SC |
28 | template<> void wxStringReadValue(const wxString &s , wxColour &data ) |
29 | { | |
40989e46 | 30 | if ( !data.Set(s) ) |
067e9be6 | 31 | { |
aad6765c JS |
32 | wxLogError(_("String To Colour : Incorrect colour specification : %s"), |
33 | s.c_str() ); | |
067e9be6 SC |
34 | data = wxNullColour; |
35 | } | |
067e9be6 SC |
36 | } |
37 | ||
38 | template<> void wxStringWriteValue(wxString &s , const wxColour &data ) | |
39 | { | |
40989e46 | 40 | s = data.GetAsString(wxC2S_HTML_SYNTAX); |
067e9be6 SC |
41 | } |
42 | ||
af498247 VZ |
43 | wxTO_STRING_IMP( wxColour ) |
44 | wxFROM_STRING_IMP( wxColour ) | |
02b7b6b0 | 45 | |
af498247 | 46 | IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour , wxObject , "wx/colour.h" , &wxTO_STRING( wxColour ) , &wxFROM_STRING( wxColour )) |
066f1b7a | 47 | |
3ff066a4 | 48 | wxBEGIN_PROPERTIES_TABLE(wxColour) |
af498247 VZ |
49 | wxREADONLY_PROPERTY( Red, unsigned char, Red, EMPTY_MACROVALUE , 0 /*flags*/, wxT("Helpstring"), wxT("group")) |
50 | wxREADONLY_PROPERTY( Green, unsigned char, Green, EMPTY_MACROVALUE , 0 /*flags*/, wxT("Helpstring"), wxT("group")) | |
51 | wxREADONLY_PROPERTY( Blue, unsigned char, Blue, EMPTY_MACROVALUE , 0 /*flags*/, wxT("Helpstring"), wxT("group")) | |
3ff066a4 | 52 | wxEND_PROPERTIES_TABLE() |
066f1b7a | 53 | |
aad6765c | 54 | wxCONSTRUCTOR_3( wxColour, unsigned char, Red, unsigned char, Green, unsigned char, Blue ) |
066f1b7a | 55 | |
3ff066a4 SC |
56 | wxBEGIN_HANDLERS_TABLE(wxColour) |
57 | wxEND_HANDLERS_TABLE() | |
066f1b7a | 58 | #else |
2bda0e17 | 59 | IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) |
066f1b7a | 60 | #endif |
2bda0e17 KB |
61 | |
62 | // Colour | |
63 | ||
f75aecd0 | 64 | void wxColour::Init() |
2bda0e17 | 65 | { |
aad6765c | 66 | m_isInit = false; |
f75aecd0 VZ |
67 | m_pixel = 0; |
68 | m_red = | |
69 | m_blue = | |
70 | m_green = 0; | |
2bda0e17 KB |
71 | } |
72 | ||
68dda785 | 73 | wxColour::~wxColour() |
2bda0e17 KB |
74 | { |
75 | } | |
76 | ||
40989e46 | 77 | void wxColour::InitWith(unsigned char r, unsigned char g, unsigned char b) |
2bda0e17 | 78 | { |
f75aecd0 VZ |
79 | m_red = r; |
80 | m_green = g; | |
81 | m_blue = b; | |
aad6765c JS |
82 | m_isInit = true; |
83 | m_pixel = PALETTERGB(m_red, m_green, m_blue); | |
2bda0e17 | 84 | } |