]> git.saurik.com Git - wxWidgets.git/blame - src/osx/carbon/colordlg.cpp
Set svn properties on .cpp files.
[wxWidgets.git] / src / osx / carbon / colordlg.cpp
CommitLineData
489468fe
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
10// Licence: wxWindows licence
11/////////////////////////////////////////////////////////////////////////////
12
13#include "wx/wxprec.h"
14
1f0c8f31 15#include "wx/osx/colordlg.h"
489468fe
SC
16#include "wx/fontdlg.h"
17
18
19#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
20
21IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
22
1f0c8f31 23#include "wx/osx/private.h"
489468fe
SC
24
25/*
26 * wxColourDialog
27 */
28
29wxColourDialog::wxColourDialog()
30{
31 m_dialogParent = NULL;
32}
33
34wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data)
35{
36 Create(parent, data);
37}
38
39bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
40{
41 m_dialogParent = parent;
42
43 if (data)
44 m_colourData = *data;
45 return true;
46}
47
48int wxColourDialog::ShowModal()
49{
50 RGBColor currentColor ;
03647350 51
8cbc59fe 52 m_colourData.m_dataColour.GetRGBColor( &currentColor );
489468fe
SC
53 NColorPickerInfo info;
54 OSStatus err ;
55 memset(&info, 0, sizeof(info)) ;
56 // TODO : use parent to determine better position and then kAtSpecifiedOrigin
03647350 57 info.placeWhere = kCenterOnMainScreen ;
489468fe
SC
58 info.flags = kColorPickerDialogIsMoveable | kColorPickerDialogIsModal ;
59 info.theColor.color.rgb.red = currentColor.red ;
60 info.theColor.color.rgb.green = currentColor.green ;
61 info.theColor.color.rgb.blue = currentColor.blue ;
445e564f 62 wxDialog::OSXBeginModalDialog();
489468fe 63 err = NPickColor(&info);
445e564f 64 wxDialog::OSXEndModalDialog();
489468fe
SC
65 if ((err == noErr) && info.newColorChosen)
66 {
67 currentColor.red = info.theColor.color.rgb.red ;
68 currentColor.green = info.theColor.color.rgb.green ;
69 currentColor.blue = info.theColor.color.rgb.blue ;
70 m_colourData.m_dataColour = currentColor;
71
72 return wxID_OK;
73 }
74 return wxID_CANCEL;
75}
76
77#endif