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