]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/colordlg.cpp
Allow displaying Japanese character with wxMotif/ANSI under a
[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 #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
32 #include "wx/defs.h"
33 #include "wx/intl.h"
34 #endif
35
36 #if wxUSE_COLOURDLG
37
38 #include "wx/cmndata.h"
39 #include "wx/colordlg.h"
40
41 #include <UIColor.h>
42 #include <UIControls.h>
43
44 // ----------------------------------------------------------------------------
45 // wxWin macros
46 // ----------------------------------------------------------------------------
47
48 IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
49
50 // ============================================================================
51 // implementation
52 // ============================================================================
53
54 // ----------------------------------------------------------------------------
55 // wxColourDialog
56 // ----------------------------------------------------------------------------
57
58 wxColourDialog::wxColourDialog()
59 {
60 }
61
62 wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data)
63 {
64 Create(parent, data);
65 }
66
67 bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
68 {
69 m_parent = parent;
70
71 if (data)
72 m_colourData = *data;
73
74 return true;
75 }
76
77 int wxColourDialog::ShowModal()
78 {
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;
98 }
99
100 #endif