]> git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/colordlg.cpp
added wxID_ANY default value for the id parameter of Create() for consistency with...
[wxWidgets.git] / src / mac / classic / colordlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: colordlg.cpp
3 // Purpose: wxColourDialog class. NOTE: you can use the generic class
4 // if you wish, instead of implementing this.
5 // Author: Stefan Csomor
6 // Modified by:
7 // Created: 1998-01-01
8 // RCS-ID: $Id$
9 // Copyright: (c) Stefan Csomor
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #include "wx/mac/colordlg.h"
14
15 IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
16
17 #include "wx/mac/private.h"
18 #ifndef __DARWIN__
19 #include <ColorPicker.h>
20 #endif
21
22 /*
23 * wxColourDialog
24 */
25
26 wxColourDialog::wxColourDialog()
27 {
28 m_dialogParent = NULL;
29 }
30
31 wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data)
32 {
33 Create(parent, data);
34 }
35
36 bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
37 {
38 m_dialogParent = parent;
39
40 if (data)
41 m_colourData = *data;
42 return TRUE;
43 }
44
45 int wxColourDialog::ShowModal()
46 {
47 Point where ;
48 RGBColor currentColor = *((RGBColor*)m_colourData.m_dataColour.GetPixel()) , newColor ;
49
50 where.h = where.v = -1;
51
52 if (GetColor( where, "\pSelect a new palette color.", &currentColor, &newColor ))
53 {
54 m_colourData.m_dataColour.Set( (WXCOLORREF*) &newColor ) ;
55 return wxID_OK;
56 }
57 else
58 {
59 return wxID_CANCEL;
60 }
61
62 return wxID_CANCEL;
63 }
64