]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/colordlg.cpp
Query value from the model column given by col->GetModelColumn()
[wxWidgets.git] / src / mac / carbon / 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.
a31a5f85 5// Author: Stefan Csomor
e9576ca5 6// Modified by:
a31a5f85 7// Created: 1998-01-01
e9576ca5 8// RCS-ID: $Id$
a31a5f85 9// Copyright: (c) Stefan Csomor
65571936 10// Licence: wxWindows licence
e9576ca5
SC
11/////////////////////////////////////////////////////////////////////////////
12
a8e9860d
SC
13#include "wx/wxprec.h"
14
519cb848 15#include "wx/mac/colordlg.h"
356c775f
RN
16#include "wx/fontdlg.h"
17
18
19#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
e9576ca5 20
e9576ca5 21IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
e9576ca5 22
76a5e5d2
SC
23#include "wx/mac/private.h"
24
e9576ca5
SC
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;
902725ee 42
e9576ca5
SC
43 if (data)
44 m_colourData = *data;
902725ee 45 return true;
e9576ca5
SC
46}
47
48int wxColourDialog::ShowModal()
49{
ed6e7f8c
SC
50 RGBColor currentColor ;
51
52 m_colourData.m_dataColour.GetRGBColor( currentColor );
7ea1c917
SC
53 NColorPickerInfo info;
54 OSStatus err ;
55 memset(&info, 0, sizeof(info)) ;
56 // TODO : use parent to determine better position and then kAtSpecifiedOrigin
57 info.placeWhere = kCenterOnMainScreen ;
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 ;
62 err = NPickColor(&info);
63 if ((err == noErr) && info.newColorChosen)
64 {
65 currentColor.red = info.theColor.color.rgb.red ;
66 currentColor.green = info.theColor.color.rgb.green ;
67 currentColor.blue = info.theColor.color.rgb.blue ;
055de350 68 m_colourData.m_dataColour = currentColor;
a166eb64 69
7ea1c917
SC
70 return wxID_OK;
71 }
e9576ca5
SC
72 return wxID_CANCEL;
73}
74
356c775f 75#endif