1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/colrdlgg.h
3 // Purpose: wxGenericColourDialog
4 // Author: Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __COLORDLGH_G__
13 #define __COLORDLGH_G__
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "colrdlgg.h"
20 #include "wx/gdicmn.h"
21 #include "wx/dialog.h"
22 #include "wx/cmndata.h"
24 #define wxID_ADD_CUSTOM 3000
28 #define wxID_RED_SLIDER 3001
29 #define wxID_GREEN_SLIDER 3002
30 #define wxID_BLUE_SLIDER 3003
32 class WXDLLEXPORT wxSlider
;
34 #endif // wxUSE_SLIDER
36 class WXDLLEXPORT wxGenericColourDialog
: public wxDialog
39 wxGenericColourDialog();
40 wxGenericColourDialog(wxWindow
*parent
,
41 wxColourData
*data
= (wxColourData
*) NULL
);
42 virtual ~wxGenericColourDialog();
44 bool Create(wxWindow
*parent
, wxColourData
*data
= (wxColourData
*) NULL
);
46 wxColourData
&GetColourData() { return colourData
; }
48 virtual int ShowModal();
51 void OnMouseEvent(wxMouseEvent
& event
);
52 void OnPaint(wxPaintEvent
& event
);
54 virtual void CalculateMeasurements();
55 virtual void CreateWidgets();
56 virtual void InitializeColours();
58 virtual void PaintBasicColours(wxDC
& dc
);
59 virtual void PaintCustomColours(wxDC
& dc
);
60 virtual void PaintCustomColour(wxDC
& dc
);
61 virtual void PaintHighlight(wxDC
& dc
, bool draw
);
63 virtual void OnBasicColourClick(int which
);
64 virtual void OnCustomColourClick(int which
);
66 void OnAddCustom(wxCommandEvent
& event
);
69 void OnRedSlider(wxCommandEvent
& event
);
70 void OnGreenSlider(wxCommandEvent
& event
);
71 void OnBlueSlider(wxCommandEvent
& event
);
72 #endif // wxUSE_SLIDER
74 void OnCloseWindow(wxCloseEvent
& event
);
77 wxColourData colourData
;
78 wxWindow
*dialogParent
;
80 // Area reserved for grids of colours
81 wxRect standardColoursRect
;
82 wxRect customColoursRect
;
83 wxRect singleCustomColourRect
;
85 // Size of each colour rectangle
86 wxPoint smallRectangleSize
;
88 // For single customizable colour
89 wxPoint customRectangleSize
;
91 // Grid spacing (between rectangles)
94 // Section spacing (between left and right halves of dialog box)
97 // 48 'standard' colours
98 wxColour standardColours
[48];
100 // 16 'custom' colours
101 wxColour customColours
[16];
103 // Which colour is selected? An index into one of the two areas.
105 int whichKind
; // 1 for standard colours, 2 for custom colours,
109 wxSlider
*greenSlider
;
110 wxSlider
*blueSlider
;
111 #endif // wxUSE_SLIDER
118 // static bool colourDialogCancelled;
120 DECLARE_EVENT_TABLE()
121 DECLARE_DYNAMIC_CLASS(wxGenericColourDialog
)