]>
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(NO_GCC_PRAGMA) | |
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 | ||
26 | #if wxUSE_SLIDER | |
27 | ||
28 | #define wxID_RED_SLIDER 3001 | |
29 | #define wxID_GREEN_SLIDER 3002 | |
30 | #define wxID_BLUE_SLIDER 3003 | |
31 | ||
32 | class WXDLLEXPORT wxSlider; | |
33 | ||
34 | #endif // wxUSE_SLIDER | |
35 | ||
36 | class WXDLLEXPORT wxGenericColourDialog : public wxDialog | |
37 | { | |
38 | public: | |
39 | wxGenericColourDialog(); | |
40 | wxGenericColourDialog(wxWindow *parent, | |
41 | wxColourData *data = (wxColourData *) NULL); | |
42 | virtual ~wxGenericColourDialog(); | |
43 | ||
44 | bool Create(wxWindow *parent, wxColourData *data = (wxColourData *) NULL); | |
45 | ||
46 | wxColourData &GetColourData() { return colourData; } | |
47 | ||
48 | virtual int ShowModal(); | |
49 | ||
50 | // Internal functions | |
51 | void OnMouseEvent(wxMouseEvent& event); | |
52 | void OnPaint(wxPaintEvent& event); | |
53 | ||
54 | virtual void CalculateMeasurements(); | |
55 | virtual void CreateWidgets(); | |
56 | virtual void InitializeColours(); | |
57 | ||
58 | virtual void PaintBasicColours(wxDC& dc); | |
59 | virtual void PaintCustomColours(wxDC& dc); | |
60 | virtual void PaintCustomColour(wxDC& dc); | |
61 | virtual void PaintHighlight(wxDC& dc, bool draw); | |
62 | ||
63 | virtual void OnBasicColourClick(int which); | |
64 | virtual void OnCustomColourClick(int which); | |
65 | ||
66 | void OnAddCustom(wxCommandEvent& event); | |
67 | ||
68 | #if wxUSE_SLIDER | |
69 | void OnRedSlider(wxCommandEvent& event); | |
70 | void OnGreenSlider(wxCommandEvent& event); | |
71 | void OnBlueSlider(wxCommandEvent& event); | |
72 | #endif // wxUSE_SLIDER | |
73 | ||
74 | void OnCloseWindow(wxCloseEvent& event); | |
75 | ||
76 | protected: | |
77 | wxColourData colourData; | |
78 | wxWindow *dialogParent; | |
79 | ||
80 | // Area reserved for grids of colours | |
81 | wxRect standardColoursRect; | |
82 | wxRect customColoursRect; | |
83 | wxRect singleCustomColourRect; | |
84 | ||
85 | // Size of each colour rectangle | |
86 | wxPoint smallRectangleSize; | |
87 | ||
88 | // For single customizable colour | |
89 | wxPoint customRectangleSize; | |
90 | ||
91 | // Grid spacing (between rectangles) | |
92 | int gridSpacing; | |
93 | ||
94 | // Section spacing (between left and right halves of dialog box) | |
95 | int sectionSpacing; | |
96 | ||
97 | // 48 'standard' colours | |
98 | wxColour standardColours[48]; | |
99 | ||
100 | // 16 'custom' colours | |
101 | wxColour customColours[16]; | |
102 | ||
103 | // Which colour is selected? An index into one of the two areas. | |
104 | int colourSelection; | |
105 | int whichKind; // 1 for standard colours, 2 for custom colours, | |
106 | ||
107 | #if wxUSE_SLIDER | |
108 | wxSlider *redSlider; | |
109 | wxSlider *greenSlider; | |
110 | wxSlider *blueSlider; | |
111 | #endif // wxUSE_SLIDER | |
112 | ||
113 | int buttonY; | |
114 | ||
115 | int okButtonX; | |
116 | int customButtonX; | |
117 | ||
118 | // static bool colourDialogCancelled; | |
119 | ||
120 | DECLARE_EVENT_TABLE() | |
121 | DECLARE_DYNAMIC_CLASS(wxGenericColourDialog) | |
122 | }; | |
123 | ||
124 | #endif |