]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/colordlg.cpp
Fix test for wxHAS_GENERIC_PANEL for PCH-less build.
[wxWidgets.git] / src / palmos / colordlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/colordlg.cpp
3 // Purpose: wxColourDialog class
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by:
6 // Created: 10/13/04
7 // RCS-ID: $Id$
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
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 #if wxUSE_COLOURDLG
28
29 #include "wx/colordlg.h"
30
31 #ifndef WX_PRECOMP
32 #include "wx/intl.h"
33 #endif
34
35 #include <UIColor.h>
36 #include <UIControls.h>
37
38 // ----------------------------------------------------------------------------
39 // wxWin macros
40 // ----------------------------------------------------------------------------
41
42 IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
43
44 // ============================================================================
45 // implementation
46 // ============================================================================
47
48 // ----------------------------------------------------------------------------
49 // wxColourDialog
50 // ----------------------------------------------------------------------------
51
52 wxColourDialog::wxColourDialog()
53 {
54 }
55
56 wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data)
57 {
58 Create(parent, data);
59 }
60
61 bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
62 {
63 m_parent = parent;
64
65 if (data)
66 m_colourData = *data;
67
68 return true;
69 }
70
71 int wxColourDialog::ShowModal()
72 {
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;
92 }
93
94 #endif