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