]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/colour.cpp
No res-include for rpmspec wx24dsp
[wxWidgets.git] / src / palmos / colour.cpp
CommitLineData
ffecfa5a 1/////////////////////////////////////////////////////////////////////////////
e2731512 2// Name: src/palmos/colour.cpp
ffecfa5a 3// Purpose: wxColour class
e2731512 4// Author: William Osborne - minimal working wxPalmOS port
ffecfa5a
JS
5// Modified by:
6// Created: 10/13/04
e2731512 7// RCS-ID: $Id$
ffecfa5a
JS
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13#pragma implementation "colour.h"
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18#include "wx/colour.h"
19
20#ifdef __BORLANDC__
21#pragma hdrstop
22#endif
23
24#include "wx/gdicmn.h"
25
26#include <string.h>
27
28#if wxUSE_EXTENDED_RTTI
29
30template<> void wxStringReadValue(const wxString &s , wxColour &data )
31{
32 // copied from VS xrc
33 unsigned long tmp = 0;
34
35 if (s.Length() != 7 || s[0u] != wxT('#')
36 || wxSscanf(s.c_str(), wxT("#%lX"), &tmp) != 1)
37 {
38 wxLogError(_("String To Colour : Incorrect colour specification : %s"),
39 s.c_str() );
40 data = wxNullColour;
41 }
42 else
43 {
44 data = wxColour((unsigned char) ((tmp & 0xFF0000) >> 16) ,
45 (unsigned char) ((tmp & 0x00FF00) >> 8),
46 (unsigned char) ((tmp & 0x0000FF)));
47 }
48}
49
50template<> void wxStringWriteValue(wxString &s , const wxColour &data )
51{
52 s = wxString::Format(wxT("#%02X%02X%02X"),
53 data.Red(), data.Green(), data.Blue() );
54}
55
56wxTO_STRING_IMP( wxColour )
57wxFROM_STRING_IMP( wxColour )
e2731512 58
ffecfa5a
JS
59IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour , wxObject , "wx/colour.h" , &wxTO_STRING( wxColour ) , &wxFROM_STRING( wxColour ))
60
61wxBEGIN_PROPERTIES_TABLE(wxColour)
62 wxREADONLY_PROPERTY( Red, unsigned char, Red, EMPTY_MACROVALUE , 0 /*flags*/, wxT("Helpstring"), wxT("group"))
63 wxREADONLY_PROPERTY( Green, unsigned char, Green, EMPTY_MACROVALUE , 0 /*flags*/, wxT("Helpstring"), wxT("group"))
64 wxREADONLY_PROPERTY( Blue, unsigned char, Blue, EMPTY_MACROVALUE , 0 /*flags*/, wxT("Helpstring"), wxT("group"))
65wxEND_PROPERTIES_TABLE()
66
67wxCONSTRUCTOR_3( wxColour, unsigned char, Red, unsigned char, Green, unsigned char, Blue )
68
69wxBEGIN_HANDLERS_TABLE(wxColour)
70wxEND_HANDLERS_TABLE()
71#else
72IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
73#endif
74
75// Colour
76
77void wxColour::Init()
78{
79 m_isInit = false;
80 m_pixel = 0;
81 m_red =
82 m_blue =
83 m_green = 0;
84}
85
86wxColour::wxColour(const wxColour& col)
87{
88 *this = col;
89}
90
91wxColour& wxColour::operator=(const wxColour& col)
92{
93 m_red = col.m_red;
94 m_green = col.m_green;
95 m_blue = col.m_blue;
96 m_isInit = col.m_isInit;
97 m_pixel = col.m_pixel;
98 return *this;
99}
100
101void wxColour::InitFromName(const wxString& name)
102{
103 // leave invalid
104 Init();
105}
106
107wxColour::~wxColour()
108{
109}
110
111void wxColour::Set(unsigned char r, unsigned char g, unsigned char b)
112{
113}
114