]>
Commit | Line | Data |
---|---|---|
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 | // ---------------------------------------------------------------------------- | |
42 | // wxWin macros | |
43 | // ---------------------------------------------------------------------------- | |
44 | ||
45 | IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) | |
46 | ||
47 | // ============================================================================ | |
48 | // implementation | |
49 | // ============================================================================ | |
50 | ||
51 | // ---------------------------------------------------------------------------- | |
52 | // wxColourDialog | |
53 | // ---------------------------------------------------------------------------- | |
54 | ||
55 | wxColourDialog::wxColourDialog() | |
56 | { | |
57 | } | |
58 | ||
59 | wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data) | |
60 | { | |
61 | Create(parent, data); | |
62 | } | |
63 | ||
64 | bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) | |
65 | { | |
66 | m_parent = parent; | |
67 | ||
68 | if (data) | |
69 | m_colourData = *data; | |
70 | ||
71 | return true; | |
72 | } | |
73 | ||
74 | int wxColourDialog::ShowModal() | |
75 | { | |
76 | wxString title = _("Choose colour"); | |
77 | ||
78 | wxColour colour = m_colourData.GetColour(); | |
79 | RGBColorType rgb; | |
80 | rgb.r = colour.Red(); | |
81 | rgb.g = colour.Green(); | |
82 | rgb.b = colour.Blue(); | |
83 | IndexedColorType i = WinRGBToIndex ( &rgb ); | |
84 | ||
85 | if (UIPickColor (&i, | |
86 | &rgb, | |
87 | (m_colourData.GetChooseFull()?UIPickColorStartRGB:UIPickColorStartPalette), | |
88 | title.ToAscii(), | |
89 | NULL) == false) | |
90 | return wxID_CANCEL; | |
91 | ||
92 | colour.Set(rgb.r, rgb.g, rgb.b); | |
93 | m_colourData.SetColour(colour); | |
94 | return wxID_OK; | |
95 | } | |
96 | ||
97 | #endif |