1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGenericColourDialog
4 // Author: Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __COLORDLGH_G__
13 #define __COLORDLGH_G__
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
25 #define wxID_RED_SLIDER 3001
26 #define wxID_GREEN_SLIDER 3002
27 #define wxID_BLUE_SLIDER 3003
29 class WXDLLEXPORT wxSlider
;
30 class WXDLLEXPORT wxGenericColourDialog
: public wxDialog
32 DECLARE_DYNAMIC_CLASS(wxGenericColourDialog
)
34 wxColourData colourData
;
35 wxWindow
*dialogParent
;
37 // Area reserved for grids of colours
38 wxRect standardColoursRect
;
39 wxRect customColoursRect
;
40 wxRect singleCustomColourRect
;
42 // Size of each colour rectangle
43 wxPoint smallRectangleSize
;
45 // For single customizable colour
46 wxPoint customRectangleSize
;
48 // Grid spacing (between rectangles)
51 // Section spacing (between left and right halves of dialog box)
54 // 48 'standard' colours
55 wxColour standardColours
[48];
57 // 16 'custom' colours
58 wxColour customColours
[16];
60 // One single custom colour (use sliders)
61 wxColour singleCustomColour
;
63 // Which colour is selected? An index into one of the two areas.
65 int whichKind
; // 1 for standard colours, 2 for custom colours,
68 wxSlider
*greenSlider
;
76 // static bool colourDialogCancelled;
78 wxGenericColourDialog(void);
79 wxGenericColourDialog(wxWindow
*parent
, wxColourData
*data
= (wxColourData
*) NULL
);
80 ~wxGenericColourDialog(void);
82 bool Create(wxWindow
*parent
, wxColourData
*data
= (wxColourData
*) NULL
);
85 wxColourData
&GetColourData(void) { return colourData
; }
88 void OnMouseEvent(wxMouseEvent
& event
);
89 void OnPaint(wxPaintEvent
& event
);
93 virtual void CalculateMeasurements(void);
94 virtual void CreateWidgets(void);
95 virtual void InitializeColours(void);
97 virtual void PaintBasicColours(wxDC
& dc
);
98 virtual void PaintCustomColours(wxDC
& dc
);
99 virtual void PaintCustomColour(wxDC
& dc
);
100 virtual void PaintHighlight(wxDC
& dc
, bool draw
);
102 virtual void OnBasicColourClick(int which
);
103 virtual void OnCustomColourClick(int which
);
106 virtual void OnOk(void);
107 virtual void OnCancel(void);
108 virtual void OnAddCustom(void);
110 void OnAddCustom(wxCommandEvent
& event
);
112 void OnRedSlider(wxCommandEvent
& event
);
113 void OnGreenSlider(wxCommandEvent
& event
);
114 void OnBlueSlider(wxCommandEvent
& event
);
116 DECLARE_EVENT_TABLE()
120 typedef wxGenericColourDialog wxColourDialog
;