]> git.saurik.com Git - wxWidgets.git/blame - src/mac/classic/colordlg.cpp
create stock GDI objects on demand; use const with GDI objects appropriately (patch...
[wxWidgets.git] / src / mac / classic / colordlg.cpp
CommitLineData
2646f485
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: Stefan Csomor
6// Modified by:
7// Created: 1998-01-01
8// RCS-ID: $Id$
9// Copyright: (c) Stefan Csomor
65571936 10// Licence: wxWindows licence
2646f485
SC
11/////////////////////////////////////////////////////////////////////////////
12
2646f485
SC
13#include "wx/mac/colordlg.h"
14
2646f485 15IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
2646f485
SC
16
17#include "wx/mac/private.h"
18#ifndef __DARWIN__
19#include <ColorPicker.h>
20#endif
21
22/*
23 * wxColourDialog
24 */
25
26wxColourDialog::wxColourDialog()
27{
28 m_dialogParent = NULL;
29}
30
31wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data)
32{
33 Create(parent, data);
34}
35
36bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
37{
38 m_dialogParent = parent;
39
40 if (data)
41 m_colourData = *data;
42 return TRUE;
43}
44
45int 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