]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
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 | |
16e93305 JS |
38 | wxRect standardColoursRect; |
39 | wxRect customColoursRect; | |
40 | wxRect singleCustomColourRect; | |
c801d85f KB |
41 | |
42 | // Size of each colour rectangle | |
f5419957 | 43 | wxPoint smallRectangleSize; |
c801d85f KB |
44 | |
45 | // For single customizable colour | |
f5419957 | 46 | wxPoint customRectangleSize; |
c801d85f KB |
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); | |
c67daf87 | 79 | wxGenericColourDialog(wxWindow *parent, wxColourData *data = (wxColourData *) NULL); |
c801d85f KB |
80 | ~wxGenericColourDialog(void); |
81 | ||
c67daf87 | 82 | bool Create(wxWindow *parent, wxColourData *data = (wxColourData *) NULL); |
c801d85f KB |
83 | |
84 | int ShowModal(void); | |
4f22cf8d | 85 | wxColourData &GetColourData(void) { return colourData; } |
c801d85f KB |
86 | |
87 | // Internal functions | |
88 | void OnMouseEvent(wxMouseEvent& event); | |
89 | void OnPaint(wxPaintEvent& event); | |
90 | ||
c801d85f KB |
91 | virtual void CalculateMeasurements(void); |
92 | virtual void CreateWidgets(void); | |
93 | virtual void InitializeColours(void); | |
94 | ||
95 | virtual void PaintBasicColours(wxDC& dc); | |
96 | virtual void PaintCustomColours(wxDC& dc); | |
97 | virtual void PaintCustomColour(wxDC& dc); | |
98 | virtual void PaintHighlight(wxDC& dc, bool draw); | |
99 | ||
100 | virtual void OnBasicColourClick(int which); | |
101 | virtual void OnCustomColourClick(int which); | |
102 | ||
c801d85f KB |
103 | void OnAddCustom(wxCommandEvent& event); |
104 | ||
105 | void OnRedSlider(wxCommandEvent& event); | |
106 | void OnGreenSlider(wxCommandEvent& event); | |
107 | void OnBlueSlider(wxCommandEvent& event); | |
108 | ||
e3065973 JS |
109 | void OnCloseWindow(wxCloseEvent& event); |
110 | ||
c801d85f KB |
111 | DECLARE_EVENT_TABLE() |
112 | }; | |
113 | ||
2049ba38 | 114 | #ifdef __WXGTK__ |
c801d85f | 115 | typedef wxGenericColourDialog wxColourDialog; |
ef77f91e | 116 | #endif |
c801d85f KB |
117 | |
118 | #endif |