]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/colordlg.cpp
Added validator to generic date picker control
[wxWidgets.git] / src / palmos / colordlg.cpp
CommitLineData
ffecfa5a
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/palmos/colordlg.cpp
3// Purpose: wxColourDialog 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// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "colordlg.h"
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
28 #pragma hdrstop
29#endif
30
31#ifndef WX_PRECOMP
ffecfa5a 32 #include "wx/defs.h"
f5d9cc73 33 #include "wx/intl.h"
ffecfa5a
JS
34#endif
35
f5d9cc73 36#if wxUSE_COLOURDLG
ffecfa5a 37
ffecfa5a 38#include "wx/cmndata.h"
f5d9cc73 39#include "wx/colordlg.h"
ffecfa5a
JS
40
41// ----------------------------------------------------------------------------
42// wxWin macros
43// ----------------------------------------------------------------------------
44
45IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
46
47// ============================================================================
48// implementation
49// ============================================================================
50
51// ----------------------------------------------------------------------------
52// wxColourDialog
53// ----------------------------------------------------------------------------
54
55wxColourDialog::wxColourDialog()
56{
57}
58
59wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data)
60{
f5d9cc73 61 Create(parent, data);
ffecfa5a
JS
62}
63
64bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
65{
f5d9cc73 66 m_parent = parent;
ffecfa5a 67
f5d9cc73
WS
68 if (data)
69 m_colourData = *data;
ffecfa5a 70
f5d9cc73 71 return true;
ffecfa5a
JS
72}
73
f5d9cc73 74int wxColourDialog::ShowModal()
ffecfa5a 75{
f5d9cc73
WS
76 wxString title = _("Choose colour");
77
78 wxColour colour = m_colourData.GetColour();
79 RGBColorType rgb;
80 rgb.r = colour.Red();
81 rgb.g = colour.Green();
82 rgb.b = colour.Blue();
83 IndexedColorType i = WinRGBToIndex ( &rgb );
84
85 if (UIPickColor (&i,
86 &rgb,
87 (m_colourData.GetChooseFull()?UIPickColorStartRGB:UIPickColorStartPalette),
88 title.ToAscii(),
89 NULL) == false)
90 return wxID_CANCEL;
91
92 colour.Set(rgb.r, rgb.g, rgb.b);
93 m_colourData.SetColour(colour);
94 return wxID_OK;
ffecfa5a
JS
95}
96
97#endif