]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/colordlg.cpp
factoring out Background setter
[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 #ifndef WX_PRECOMP
28 #include "wx/defs.h"
29 #include "wx/intl.h"
30 #endif
31
32 #if wxUSE_COLOURDLG
33
34 #include "wx/cmndata.h"
35 #include "wx/colordlg.h"
36
37 #include <UIColor.h>
38 #include <UIControls.h>
39
40 // ----------------------------------------------------------------------------
41 // wxWin macros
42 // ----------------------------------------------------------------------------
43
44 IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
45
46 // ============================================================================
47 // implementation
48 // ============================================================================
49
50 // ----------------------------------------------------------------------------
51 // wxColourDialog
52 // ----------------------------------------------------------------------------
53
54 wxColourDialog::wxColourDialog()
55 {
56 }
57
58 wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data)
59 {
60 Create(parent, data);
61 }
62
63 bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
64 {
65 m_parent = parent;
66
67 if (data)
68 m_colourData = *data;
69
70 return true;
71 }
72
73 int wxColourDialog::ShowModal()
74 {
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;
94 }
95
96 #endif