]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/colrdlgg.h
event/leave events
[wxWidgets.git] / include / wx / generic / colrdlgg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: colrdlgg.h
3 // Purpose: wxGenericColourDialog
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __COLORDLGH_G__
13 #define __COLORDLGH_G__
14
15 #ifdef __GNUG__
16 #pragma interface "colrdlgg.h"
17 #endif
18
19 #include "wx/setup.h"
20 #include "wx/gdicmn.h"
21 #include "wx/dialog.h"
22 #include "wx/cmndata.h"
23
24 #define wxID_ADD_CUSTOM 3000
25 #define wxID_RED_SLIDER 3001
26 #define wxID_GREEN_SLIDER 3002
27 #define wxID_BLUE_SLIDER 3003
28
29 class WXDLLEXPORT wxSlider;
30 class WXDLLEXPORT wxGenericColourDialog: public wxDialog
31 {
32 DECLARE_DYNAMIC_CLASS(wxGenericColourDialog)
33 protected:
34 wxColourData colourData;
35 wxWindow *dialogParent;
36
37 // Area reserved for grids of colours
38 wxRectangle standardColoursRect;
39 wxRectangle customColoursRect;
40 wxRectangle singleCustomColourRect;
41
42 // Size of each colour rectangle
43 wxIntPoint smallRectangleSize;
44
45 // For single customizable colour
46 wxIntPoint customRectangleSize;
47
48 // Grid spacing (between rectangles)
49 int gridSpacing;
50
51 // Section spacing (between left and right halves of dialog box)
52 int sectionSpacing;
53
54 // 48 'standard' colours
55 wxColour standardColours[48];
56
57 // 16 'custom' colours
58 wxColour customColours[16];
59
60 // One single custom colour (use sliders)
61 wxColour singleCustomColour;
62
63 // Which colour is selected? An index into one of the two areas.
64 int colourSelection;
65 int whichKind; // 1 for standard colours, 2 for custom colours,
66
67 wxSlider *redSlider;
68 wxSlider *greenSlider;
69 wxSlider *blueSlider;
70
71 int buttonY;
72
73 int okButtonX;
74 int customButtonX;
75
76 // static bool colourDialogCancelled;
77 public:
78 wxGenericColourDialog(void);
79 wxGenericColourDialog(wxWindow *parent, wxColourData *data = NULL);
80 ~wxGenericColourDialog(void);
81
82 bool Create(wxWindow *parent, wxColourData *data = NULL);
83
84 int ShowModal(void);
85 wxColourData GetColourData(void) { return colourData; }
86
87 // Internal functions
88 void OnMouseEvent(wxMouseEvent& event);
89 void OnPaint(wxPaintEvent& event);
90
91 bool OnClose(void);
92
93 virtual void CalculateMeasurements(void);
94 virtual void CreateWidgets(void);
95 virtual void InitializeColours(void);
96
97 virtual void PaintBasicColours(wxDC& dc);
98 virtual void PaintCustomColours(wxDC& dc);
99 virtual void PaintCustomColour(wxDC& dc);
100 virtual void PaintHighlight(wxDC& dc, bool draw);
101
102 virtual void OnBasicColourClick(int which);
103 virtual void OnCustomColourClick(int which);
104
105 /*
106 virtual void OnOk(void);
107 virtual void OnCancel(void);
108 virtual void OnAddCustom(void);
109 */
110 void OnAddCustom(wxCommandEvent& event);
111
112 void OnRedSlider(wxCommandEvent& event);
113 void OnGreenSlider(wxCommandEvent& event);
114 void OnBlueSlider(wxCommandEvent& event);
115
116 DECLARE_EVENT_TABLE()
117 };
118
119 #ifdef __WXGTK__
120 typedef wxGenericColourDialog wxColourDialog;
121 #endif
122
123 #endif