don't use annoying and unneeded in C++ casts of NULL to "T *" in all other files...
[wxWidgets.git] / include / wx / generic / colrdlgg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/colrdlgg.h
3 // Purpose: wxGenericColourDialog
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __COLORDLGH_G__
13 #define __COLORDLGH_G__
14
15 #include "wx/defs.h"
16 #include "wx/gdicmn.h"
17 #include "wx/dialog.h"
18 #include "wx/cmndata.h"
19
20 #define wxID_ADD_CUSTOM 3000
21
22 #if wxUSE_SLIDER
23
24 #define wxID_RED_SLIDER 3001
25 #define wxID_GREEN_SLIDER 3002
26 #define wxID_BLUE_SLIDER 3003
27
28 class WXDLLIMPEXP_FWD_CORE wxSlider;
29
30 #endif // wxUSE_SLIDER
31
32 class WXDLLIMPEXP_CORE wxGenericColourDialog : public wxDialog
33 {
34 public:
35 wxGenericColourDialog();
36 wxGenericColourDialog(wxWindow *parent,
37 wxColourData *data = NULL);
38 virtual ~wxGenericColourDialog();
39
40 bool Create(wxWindow *parent, wxColourData *data = NULL);
41
42 wxColourData &GetColourData() { return m_colourData; }
43
44 virtual int ShowModal();
45
46 // Internal functions
47 void OnMouseEvent(wxMouseEvent& event);
48 void OnPaint(wxPaintEvent& event);
49
50 virtual void CalculateMeasurements();
51 virtual void CreateWidgets();
52 virtual void InitializeColours();
53
54 virtual void PaintBasicColours(wxDC& dc);
55 virtual void PaintCustomColours(wxDC& dc);
56 virtual void PaintCustomColour(wxDC& dc);
57 virtual void PaintHighlight(wxDC& dc, bool draw);
58
59 virtual void OnBasicColourClick(int which);
60 virtual void OnCustomColourClick(int which);
61
62 void OnAddCustom(wxCommandEvent& event);
63
64 #if wxUSE_SLIDER
65 void OnRedSlider(wxCommandEvent& event);
66 void OnGreenSlider(wxCommandEvent& event);
67 void OnBlueSlider(wxCommandEvent& event);
68 #endif // wxUSE_SLIDER
69
70 void OnCloseWindow(wxCloseEvent& event);
71
72 protected:
73 wxColourData m_colourData;
74
75 // Area reserved for grids of colours
76 wxRect m_standardColoursRect;
77 wxRect m_customColoursRect;
78 wxRect m_singleCustomColourRect;
79
80 // Size of each colour rectangle
81 wxPoint m_smallRectangleSize;
82
83 // For single customizable colour
84 wxPoint m_customRectangleSize;
85
86 // Grid spacing (between rectangles)
87 int m_gridSpacing;
88
89 // Section spacing (between left and right halves of dialog box)
90 int m_sectionSpacing;
91
92 // 48 'standard' colours
93 wxColour m_standardColours[48];
94
95 // 16 'custom' colours
96 wxColour m_customColours[16];
97
98 // Which colour is selected? An index into one of the two areas.
99 int m_colourSelection;
100 int m_whichKind; // 1 for standard colours, 2 for custom colours,
101
102 #if wxUSE_SLIDER
103 wxSlider *m_redSlider;
104 wxSlider *m_greenSlider;
105 wxSlider *m_blueSlider;
106 #endif // wxUSE_SLIDER
107
108 int m_buttonY;
109
110 int m_okButtonX;
111 int m_customButtonX;
112
113 // static bool colourDialogCancelled;
114
115 DECLARE_EVENT_TABLE()
116 DECLARE_DYNAMIC_CLASS(wxGenericColourDialog)
117 };
118
119 #endif