1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/colrdlgg.h
3 // Purpose: wxGenericColourDialog
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_COLORDLGG_H_
12 #define _WX_COLORDLGG_H_
14 #include "wx/gdicmn.h"
15 #include "wx/dialog.h"
17 #define wxID_ADD_CUSTOM 3000
21 #define wxID_RED_SLIDER 3001
22 #define wxID_GREEN_SLIDER 3002
23 #define wxID_BLUE_SLIDER 3003
25 class WXDLLIMPEXP_FWD_CORE wxSlider
;
27 #endif // wxUSE_SLIDER
29 class WXDLLIMPEXP_CORE wxGenericColourDialog
: public wxDialog
32 wxGenericColourDialog();
33 wxGenericColourDialog(wxWindow
*parent
,
34 wxColourData
*data
= NULL
);
35 virtual ~wxGenericColourDialog();
37 bool Create(wxWindow
*parent
, wxColourData
*data
= NULL
);
39 wxColourData
&GetColourData() { return m_colourData
; }
41 virtual int ShowModal();
44 void OnMouseEvent(wxMouseEvent
& event
);
45 void OnPaint(wxPaintEvent
& event
);
47 virtual void CalculateMeasurements();
48 virtual void CreateWidgets();
49 virtual void InitializeColours();
51 virtual void PaintBasicColours(wxDC
& dc
);
52 virtual void PaintCustomColours(wxDC
& dc
);
53 virtual void PaintCustomColour(wxDC
& dc
);
54 virtual void PaintHighlight(wxDC
& dc
, bool draw
);
56 virtual void OnBasicColourClick(int which
);
57 virtual void OnCustomColourClick(int which
);
59 void OnAddCustom(wxCommandEvent
& event
);
62 void OnRedSlider(wxCommandEvent
& event
);
63 void OnGreenSlider(wxCommandEvent
& event
);
64 void OnBlueSlider(wxCommandEvent
& event
);
65 #endif // wxUSE_SLIDER
67 void OnCloseWindow(wxCloseEvent
& event
);
70 wxColourData m_colourData
;
72 // Area reserved for grids of colours
73 wxRect m_standardColoursRect
;
74 wxRect m_customColoursRect
;
75 wxRect m_singleCustomColourRect
;
77 // Size of each colour rectangle
78 wxPoint m_smallRectangleSize
;
80 // For single customizable colour
81 wxPoint m_customRectangleSize
;
83 // Grid spacing (between rectangles)
86 // Section spacing (between left and right halves of dialog box)
89 // 48 'standard' colours
90 wxColour m_standardColours
[48];
92 // 16 'custom' colours
93 wxColour m_customColours
[16];
95 // Which colour is selected? An index into one of the two areas.
96 int m_colourSelection
;
97 int m_whichKind
; // 1 for standard colours, 2 for custom colours,
100 wxSlider
*m_redSlider
;
101 wxSlider
*m_greenSlider
;
102 wxSlider
*m_blueSlider
;
103 #endif // wxUSE_SLIDER
110 // static bool colourDialogCancelled;
112 DECLARE_EVENT_TABLE()
113 DECLARE_DYNAMIC_CLASS(wxGenericColourDialog
)
116 #endif // _WX_COLORDLGG_H_