]>
Commit | Line | Data |
---|---|---|
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 | #include "wx/gdicmn.h" | |
22 | #include "wx/msw/private.h" | |
23 | ||
24 | #include <string.h> | |
25 | ||
26 | #if wxUSE_EXTENDED_RTTI | |
27 | ||
28 | template<> void wxStringReadValue(const wxString &s , wxColour &data ) | |
29 | { | |
30 | if ( !data.Set(s) ) | |
31 | { | |
32 | wxLogError(_("String To Colour : Incorrect colour specification : %s"), | |
33 | s.c_str() ); | |
34 | data = wxNullColour; | |
35 | } | |
36 | } | |
37 | ||
38 | template<> void wxStringWriteValue(wxString &s , const wxColour &data ) | |
39 | { | |
40 | s = data.GetAsString(wxC2S_HTML_SYNTAX); | |
41 | } | |
42 | ||
43 | wxTO_STRING_IMP( wxColour ) | |
44 | wxFROM_STRING_IMP( wxColour ) | |
45 | ||
46 | IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour , wxObject , "wx/colour.h" , &wxTO_STRING( wxColour ) , &wxFROM_STRING( wxColour )) | |
47 | ||
48 | wxBEGIN_PROPERTIES_TABLE(wxColour) | |
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")) | |
52 | wxEND_PROPERTIES_TABLE() | |
53 | ||
54 | wxCONSTRUCTOR_3( wxColour, unsigned char, Red, unsigned char, Green, unsigned char, Blue ) | |
55 | ||
56 | wxBEGIN_HANDLERS_TABLE(wxColour) | |
57 | wxEND_HANDLERS_TABLE() | |
58 | #else | |
59 | IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) | |
60 | #endif | |
61 | ||
62 | // Colour | |
63 | ||
64 | void wxColour::Init() | |
65 | { | |
66 | m_isInit = false; | |
67 | m_pixel = 0; | |
68 | m_red = | |
69 | m_blue = | |
70 | m_green = 0; | |
71 | } | |
72 | ||
73 | wxColour::~wxColour() | |
74 | { | |
75 | } | |
76 | ||
77 | void wxColour::InitWith(unsigned char r, unsigned char g, unsigned char b) | |
78 | { | |
79 | m_red = r; | |
80 | m_green = g; | |
81 | m_blue = b; | |
82 | m_isInit = true; | |
83 | m_pixel = PALETTERGB(m_red, m_green, m_blue); | |
84 | } |