1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/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
9 // Copyright: (c) Stefan Csomor
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #include "wx/wxprec.h"
15 #include "wx/colordlg.h"
16 #include "wx/fontdlg.h"
17 #include "wx/testing.h"
20 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
22 IMPLEMENT_DYNAMIC_CLASS(wxColourDialog
, wxDialog
)
24 #include "wx/osx/private.h"
30 wxColourDialog::wxColourDialog()
32 m_dialogParent
= NULL
;
35 wxColourDialog::wxColourDialog(wxWindow
*parent
, wxColourData
*data
)
40 bool wxColourDialog::Create(wxWindow
*parent
, wxColourData
*data
)
42 m_dialogParent
= parent
;
49 int wxColourDialog::ShowModal()
51 WX_TESTING_SHOW_MODAL_HOOK();
53 RGBColor currentColor
;
55 m_colourData
.m_dataColour
.GetRGBColor( ¤tColor
);
56 NColorPickerInfo info
;
58 memset(&info
, 0, sizeof(info
)) ;
59 // TODO : use parent to determine better position and then kAtSpecifiedOrigin
60 info
.placeWhere
= kCenterOnMainScreen
;
61 info
.flags
= kColorPickerDialogIsMoveable
| kColorPickerDialogIsModal
;
62 info
.theColor
.color
.rgb
.red
= currentColor
.red
;
63 info
.theColor
.color
.rgb
.green
= currentColor
.green
;
64 info
.theColor
.color
.rgb
.blue
= currentColor
.blue
;
65 wxDialog::OSXBeginModalDialog();
66 err
= NPickColor(&info
);
67 wxDialog::OSXEndModalDialog();
68 if ((err
== noErr
) && info
.newColorChosen
)
70 currentColor
.red
= info
.theColor
.color
.rgb
.red
;
71 currentColor
.green
= info
.theColor
.color
.rgb
.green
;
72 currentColor
.blue
= info
.theColor
.color
.rgb
.blue
;
73 m_colourData
.m_dataColour
= currentColor
;