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 _WX_COLORDLGG_H_
13 #define _WX_COLORDLGG_H_
15 #include "wx/gdicmn.h"
16 #include "wx/dialog.h"
18 #define wxID_ADD_CUSTOM 3000
22 #define wxID_RED_SLIDER 3001
23 #define wxID_GREEN_SLIDER 3002
24 #define wxID_BLUE_SLIDER 3003
26 class WXDLLIMPEXP_FWD_CORE wxSlider
;
28 #endif // wxUSE_SLIDER
30 class WXDLLIMPEXP_CORE wxGenericColourDialog
: public wxDialog
33 wxGenericColourDialog();
34 wxGenericColourDialog(wxWindow
*parent
,
35 wxColourData
*data
= NULL
);
36 virtual ~wxGenericColourDialog();
38 bool Create(wxWindow
*parent
, wxColourData
*data
= NULL
);
40 wxColourData
&GetColourData() { return m_colourData
; }
42 virtual int ShowModal();
45 void OnMouseEvent(wxMouseEvent
& event
);
46 void OnPaint(wxPaintEvent
& event
);
48 virtual void CalculateMeasurements();
49 virtual void CreateWidgets();
50 virtual void InitializeColours();
52 virtual void PaintBasicColours(wxDC
& dc
);
53 virtual void PaintCustomColours(wxDC
& dc
);
54 virtual void PaintCustomColour(wxDC
& dc
);
55 virtual void PaintHighlight(wxDC
& dc
, bool draw
);
57 virtual void OnBasicColourClick(int which
);
58 virtual void OnCustomColourClick(int which
);
60 void OnAddCustom(wxCommandEvent
& event
);
63 void OnRedSlider(wxCommandEvent
& event
);
64 void OnGreenSlider(wxCommandEvent
& event
);
65 void OnBlueSlider(wxCommandEvent
& event
);
66 #endif // wxUSE_SLIDER
68 void OnCloseWindow(wxCloseEvent
& event
);
71 wxColourData m_colourData
;
73 // Area reserved for grids of colours
74 wxRect m_standardColoursRect
;
75 wxRect m_customColoursRect
;
76 wxRect m_singleCustomColourRect
;
78 // Size of each colour rectangle
79 wxPoint m_smallRectangleSize
;
81 // For single customizable colour
82 wxPoint m_customRectangleSize
;
84 // Grid spacing (between rectangles)
87 // Section spacing (between left and right halves of dialog box)
90 // 48 'standard' colours
91 wxColour m_standardColours
[48];
93 // 16 'custom' colours
94 wxColour m_customColours
[16];
96 // Which colour is selected? An index into one of the two areas.
97 int m_colourSelection
;
98 int m_whichKind
; // 1 for standard colours, 2 for custom colours,
101 wxSlider
*m_redSlider
;
102 wxSlider
*m_greenSlider
;
103 wxSlider
*m_blueSlider
;
104 #endif // wxUSE_SLIDER
111 // static bool colourDialogCancelled;
113 DECLARE_EVENT_TABLE()
114 DECLARE_DYNAMIC_CLASS(wxGenericColourDialog
)
117 #endif // _WX_COLORDLGG_H_