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