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