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/osx/colordlg.h"
16 #include "wx/fontdlg.h"
19 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
21 IMPLEMENT_DYNAMIC_CLASS(wxColourDialog
, wxDialog
)
23 #include "wx/osx/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
;
52 m_colourData
.m_dataColour
.GetRGBColor( currentColor
);
53 NColorPickerInfo info
;
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
)
65 currentColor
.red
= info
.theColor
.color
.rgb
.red
;
66 currentColor
.green
= info
.theColor
.color
.rgb
.green
;
67 currentColor
.blue
= info
.theColor
.color
.rgb
.blue
;
68 m_colourData
.m_dataColour
= currentColor
;