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