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