1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxColourDialog class. NOTE: you can use the generic class
4 // if you wish, instead of implementing this.
5 // Author: Stefan Csomor
9 // Copyright: (c) Stefan Csomor
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #include "wx/wxprec.h"
15 #include "wx/mac/colordlg.h"
16 #include "wx/fontdlg.h"
19 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
21 IMPLEMENT_DYNAMIC_CLASS(wxColourDialog
, wxDialog
)
23 #include "wx/mac/private.h"
29 wxColourDialog::wxColourDialog()
31 m_dialogParent
= NULL
;
34 wxColourDialog::wxColourDialog(wxWindow
*parent
, wxColourData
*data
)
39 bool wxColourDialog::Create(wxWindow
*parent
, wxColourData
*data
)
41 m_dialogParent
= parent
;
48 int wxColourDialog::ShowModal()
50 RGBColor currentColor
= *((RGBColor
*)m_colourData
.m_dataColour
.GetPixel()) ;
52 NColorPickerInfo info
;
54 memset(&info
, 0, sizeof(info
)) ;
55 // TODO : use parent to determine better position and then kAtSpecifiedOrigin
56 info
.placeWhere
= kCenterOnMainScreen
;
57 info
.flags
= kColorPickerDialogIsMoveable
| kColorPickerDialogIsModal
;
58 info
.theColor
.color
.rgb
.red
= currentColor
.red
;
59 info
.theColor
.color
.rgb
.green
= currentColor
.green
;
60 info
.theColor
.color
.rgb
.blue
= currentColor
.blue
;
61 err
= NPickColor(&info
);
62 if ((err
== noErr
) && info
.newColorChosen
)
64 currentColor
.red
= info
.theColor
.color
.rgb
.red
;
65 currentColor
.green
= info
.theColor
.color
.rgb
.green
;
66 currentColor
.blue
= info
.theColor
.color
.rgb
.blue
;
67 m_colourData
.m_dataColour
= currentColor
;