]> git.saurik.com Git - wxWidgets.git/blame - src/mac/colordlg.cpp
improved memory liberation (explicitly set to NULL after delete)
[wxWidgets.git] / src / mac / colordlg.cpp
CommitLineData
e9576ca5
SC
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: AUTHOR
6// Modified by:
7// Created: ??/??/98
8// RCS-ID: $Id$
9// Copyright: (c) AUTHOR
10// Licence: wxWindows licence
11/////////////////////////////////////////////////////////////////////////////
12
13#ifdef __GNUG__
14#pragma implementation "colordlg.h"
15#endif
16
519cb848 17#include "wx/mac/colordlg.h"
e9576ca5 18
2f1ae414 19#if !USE_SHARED_LIBRARY
e9576ca5 20IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
2f1ae414 21#endif
e9576ca5 22
76a5e5d2 23#include "wx/mac/private.h"
66a09d47
SC
24#ifndef __DARWIN__
25#include <ColorPicker.h>
26#endif
76a5e5d2 27
e9576ca5
SC
28/*
29 * wxColourDialog
30 */
31
32wxColourDialog::wxColourDialog()
33{
34 m_dialogParent = NULL;
35}
36
37wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data)
38{
39 Create(parent, data);
40}
41
42bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
43{
44 m_dialogParent = parent;
45
46 if (data)
47 m_colourData = *data;
48 return TRUE;
49}
50
51int wxColourDialog::ShowModal()
52{
519cb848 53 Point where ;
76a5e5d2 54 RGBColor currentColor = *((RGBColor*)m_colourData.dataColour.GetPixel()) , newColor ;
519cb848
SC
55
56 where.h = where.v = -1;
57
58 if (GetColor( where, "\pSelect a new palette color.", &currentColor, &newColor ))
59 {
76a5e5d2 60 m_colourData.dataColour.Set( (WXCOLORREF*) &newColor ) ;
519cb848
SC
61 return wxID_OK;
62 }
63 else
64 {
65 return wxID_CANCEL;
66 }
e9576ca5
SC
67
68 return wxID_CANCEL;
69}
70