]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/generic/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 | #if defined(__GNUG__) && !defined(__APPLE__) | |
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 | public: | |
33 | wxGenericColourDialog(); | |
34 | wxGenericColourDialog(wxWindow *parent, | |
35 | wxColourData *data = (wxColourData *) NULL); | |
36 | virtual ~wxGenericColourDialog(); | |
37 | ||
38 | bool Create(wxWindow *parent, wxColourData *data = (wxColourData *) NULL); | |
39 | ||
40 | wxColourData &GetColourData() { return colourData; } | |
41 | ||
42 | virtual int ShowModal(); | |
43 | ||
44 | // Internal functions | |
45 | void OnMouseEvent(wxMouseEvent& event); | |
46 | void OnPaint(wxPaintEvent& event); | |
47 | ||
48 | virtual void CalculateMeasurements(); | |
49 | virtual void CreateWidgets(); | |
50 | virtual void InitializeColours(); | |
51 | ||
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); | |
56 | ||
57 | virtual void OnBasicColourClick(int which); | |
58 | virtual void OnCustomColourClick(int which); | |
59 | ||
60 | void OnAddCustom(wxCommandEvent& event); | |
61 | ||
62 | void OnRedSlider(wxCommandEvent& event); | |
63 | void OnGreenSlider(wxCommandEvent& event); | |
64 | void OnBlueSlider(wxCommandEvent& event); | |
65 | ||
66 | void OnCloseWindow(wxCloseEvent& event); | |
67 | ||
68 | protected: | |
69 | wxColourData colourData; | |
70 | wxWindow *dialogParent; | |
71 | ||
72 | // Area reserved for grids of colours | |
73 | wxRect standardColoursRect; | |
74 | wxRect customColoursRect; | |
75 | wxRect singleCustomColourRect; | |
76 | ||
77 | // Size of each colour rectangle | |
78 | wxPoint smallRectangleSize; | |
79 | ||
80 | // For single customizable colour | |
81 | wxPoint customRectangleSize; | |
82 | ||
83 | // Grid spacing (between rectangles) | |
84 | int gridSpacing; | |
85 | ||
86 | // Section spacing (between left and right halves of dialog box) | |
87 | int sectionSpacing; | |
88 | ||
89 | // 48 'standard' colours | |
90 | wxColour standardColours[48]; | |
91 | ||
92 | // 16 'custom' colours | |
93 | wxColour customColours[16]; | |
94 | ||
95 | // One single custom colour (use sliders) | |
96 | wxColour singleCustomColour; | |
97 | ||
98 | // Which colour is selected? An index into one of the two areas. | |
99 | int colourSelection; | |
100 | int whichKind; // 1 for standard colours, 2 for custom colours, | |
101 | ||
102 | wxSlider *redSlider; | |
103 | wxSlider *greenSlider; | |
104 | wxSlider *blueSlider; | |
105 | ||
106 | int buttonY; | |
107 | ||
108 | int okButtonX; | |
109 | int customButtonX; | |
110 | ||
111 | // static bool colourDialogCancelled; | |
112 | ||
113 | DECLARE_EVENT_TABLE() | |
114 | DECLARE_DYNAMIC_CLASS(wxGenericColourDialog) | |
115 | }; | |
116 | ||
117 | /* This shouldn't be necessary, we have a #define in wx/colordlg.h. | |
118 | #ifdef __WXGTK__ | |
119 | typedef wxGenericColourDialog wxColourDialog; | |
120 | #endif | |
121 | */ | |
122 | ||
123 | #endif |