1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/colrdlgg.h
3 // Purpose: wxGenericColourDialog
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __COLORDLGH_G__
13 #define __COLORDLGH_G__
16 #include "wx/gdicmn.h"
17 #include "wx/dialog.h"
18 #include "wx/cmndata.h"
20 #define wxID_ADD_CUSTOM 3000
24 #define wxID_RED_SLIDER 3001
25 #define wxID_GREEN_SLIDER 3002
26 #define wxID_BLUE_SLIDER 3003
28 class WXDLLIMPEXP_FWD_CORE wxSlider
;
30 #endif // wxUSE_SLIDER
32 class WXDLLEXPORT wxGenericColourDialog
: public wxDialog
35 wxGenericColourDialog();
36 wxGenericColourDialog(wxWindow
*parent
,
37 wxColourData
*data
= (wxColourData
*) NULL
);
38 virtual ~wxGenericColourDialog();
40 bool Create(wxWindow
*parent
, wxColourData
*data
= (wxColourData
*) NULL
);
42 wxColourData
&GetColourData() { return m_colourData
; }
44 virtual int ShowModal();
47 void OnMouseEvent(wxMouseEvent
& event
);
48 void OnPaint(wxPaintEvent
& event
);
50 virtual void CalculateMeasurements();
51 virtual void CreateWidgets();
52 virtual void InitializeColours();
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
);
59 virtual void OnBasicColourClick(int which
);
60 virtual void OnCustomColourClick(int which
);
62 void OnAddCustom(wxCommandEvent
& event
);
65 void OnRedSlider(wxCommandEvent
& event
);
66 void OnGreenSlider(wxCommandEvent
& event
);
67 void OnBlueSlider(wxCommandEvent
& event
);
68 #endif // wxUSE_SLIDER
70 void OnCloseWindow(wxCloseEvent
& event
);
73 wxColourData m_colourData
;
75 // Area reserved for grids of colours
76 wxRect m_standardColoursRect
;
77 wxRect m_customColoursRect
;
78 wxRect m_singleCustomColourRect
;
80 // Size of each colour rectangle
81 wxPoint m_smallRectangleSize
;
83 // For single customizable colour
84 wxPoint m_customRectangleSize
;
86 // Grid spacing (between rectangles)
89 // Section spacing (between left and right halves of dialog box)
92 // 48 'standard' colours
93 wxColour m_standardColours
[48];
95 // 16 'custom' colours
96 wxColour m_customColours
[16];
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,
103 wxSlider
*m_redSlider
;
104 wxSlider
*m_greenSlider
;
105 wxSlider
*m_blueSlider
;
106 #endif // wxUSE_SLIDER
113 // static bool colourDialogCancelled;
115 DECLARE_EVENT_TABLE()
116 DECLARE_DYNAMIC_CLASS(wxGenericColourDialog
)