]>
Commit | Line | Data |
---|---|---|
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 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
14 | #pragma implementation "colordlg.h" | |
15 | #endif | |
16 | ||
17 | #include "wx/wxprec.h" | |
18 | ||
19 | #include "wx/mac/colordlg.h" | |
20 | #include "wx/fontdlg.h" | |
21 | ||
22 | ||
23 | #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX | |
24 | ||
25 | #if !USE_SHARED_LIBRARY | |
26 | IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) | |
27 | #endif | |
28 | ||
29 | #include "wx/mac/private.h" | |
30 | #ifndef __DARWIN__ | |
31 | #include <ColorPicker.h> | |
32 | #endif | |
33 | ||
34 | /* | |
35 | * wxColourDialog | |
36 | */ | |
37 | ||
38 | wxColourDialog::wxColourDialog() | |
39 | { | |
40 | m_dialogParent = NULL; | |
41 | } | |
42 | ||
43 | wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data) | |
44 | { | |
45 | Create(parent, data); | |
46 | } | |
47 | ||
48 | bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) | |
49 | { | |
50 | m_dialogParent = parent; | |
51 | ||
52 | if (data) | |
53 | m_colourData = *data; | |
54 | return TRUE; | |
55 | } | |
56 | ||
57 | int wxColourDialog::ShowModal() | |
58 | { | |
59 | Point where ; | |
60 | RGBColor currentColor = *((RGBColor*)m_colourData.m_dataColour.GetPixel()) , newColor ; | |
61 | ||
62 | where.h = where.v = -1; | |
63 | ||
64 | if (GetColor( where, "\pSelect a new palette color.", ¤tColor, &newColor )) | |
65 | { | |
66 | m_colourData.m_dataColour.Set( (WXCOLORREF*) &newColor ) ; | |
67 | return wxID_OK; | |
68 | } | |
69 | else | |
70 | { | |
71 | return wxID_CANCEL; | |
72 | } | |
73 | ||
74 | return wxID_CANCEL; | |
75 | } | |
76 | ||
77 | #endif |