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 WXDLLEXPORT 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 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 colourData
;
74 wxWindow
*dialogParent
;
76 // Area reserved for grids of colours
77 wxRect standardColoursRect
;
78 wxRect customColoursRect
;
79 wxRect singleCustomColourRect
;
81 // Size of each colour rectangle
82 wxPoint smallRectangleSize
;
84 // For single customizable colour
85 wxPoint customRectangleSize
;
87 // Grid spacing (between rectangles)
90 // Section spacing (between left and right halves of dialog box)
93 // 48 'standard' colours
94 wxColour standardColours
[48];
96 // 16 'custom' colours
97 wxColour customColours
[16];
99 // Which colour is selected? An index into one of the two areas.
101 int whichKind
; // 1 for standard colours, 2 for custom colours,
105 wxSlider
*greenSlider
;
106 wxSlider
*blueSlider
;
107 #endif // wxUSE_SLIDER
114 // static bool colourDialogCancelled;
116 DECLARE_EVENT_TABLE()
117 DECLARE_DYNAMIC_CLASS(wxGenericColourDialog
)