]>
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) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_COLORDLGG_H_ | |
13 | #define _WX_COLORDLGG_H_ | |
14 | ||
15 | #include "wx/gdicmn.h" | |
16 | #include "wx/dialog.h" | |
17 | ||
18 | #define wxID_ADD_CUSTOM 3000 | |
19 | ||
20 | #if wxUSE_SLIDER | |
21 | ||
22 | #define wxID_RED_SLIDER 3001 | |
23 | #define wxID_GREEN_SLIDER 3002 | |
24 | #define wxID_BLUE_SLIDER 3003 | |
25 | ||
26 | class WXDLLIMPEXP_FWD_CORE wxSlider; | |
27 | ||
28 | #endif // wxUSE_SLIDER | |
29 | ||
30 | class WXDLLIMPEXP_CORE wxGenericColourDialog : public wxDialog | |
31 | { | |
32 | public: | |
33 | wxGenericColourDialog(); | |
34 | wxGenericColourDialog(wxWindow *parent, | |
35 | wxColourData *data = NULL); | |
36 | virtual ~wxGenericColourDialog(); | |
37 | ||
38 | bool Create(wxWindow *parent, wxColourData *data = NULL); | |
39 | ||
40 | wxColourData &GetColourData() { return m_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 | #if wxUSE_SLIDER | |
63 | void OnRedSlider(wxCommandEvent& event); | |
64 | void OnGreenSlider(wxCommandEvent& event); | |
65 | void OnBlueSlider(wxCommandEvent& event); | |
66 | #endif // wxUSE_SLIDER | |
67 | ||
68 | void OnCloseWindow(wxCloseEvent& event); | |
69 | ||
70 | protected: | |
71 | wxColourData m_colourData; | |
72 | ||
73 | // Area reserved for grids of colours | |
74 | wxRect m_standardColoursRect; | |
75 | wxRect m_customColoursRect; | |
76 | wxRect m_singleCustomColourRect; | |
77 | ||
78 | // Size of each colour rectangle | |
79 | wxPoint m_smallRectangleSize; | |
80 | ||
81 | // For single customizable colour | |
82 | wxPoint m_customRectangleSize; | |
83 | ||
84 | // Grid spacing (between rectangles) | |
85 | int m_gridSpacing; | |
86 | ||
87 | // Section spacing (between left and right halves of dialog box) | |
88 | int m_sectionSpacing; | |
89 | ||
90 | // 48 'standard' colours | |
91 | wxColour m_standardColours[48]; | |
92 | ||
93 | // 16 'custom' colours | |
94 | wxColour m_customColours[16]; | |
95 | ||
96 | // Which colour is selected? An index into one of the two areas. | |
97 | int m_colourSelection; | |
98 | int m_whichKind; // 1 for standard colours, 2 for custom colours, | |
99 | ||
100 | #if wxUSE_SLIDER | |
101 | wxSlider *m_redSlider; | |
102 | wxSlider *m_greenSlider; | |
103 | wxSlider *m_blueSlider; | |
104 | #endif // wxUSE_SLIDER | |
105 | ||
106 | int m_buttonY; | |
107 | ||
108 | int m_okButtonX; | |
109 | int m_customButtonX; | |
110 | ||
111 | // static bool colourDialogCancelled; | |
112 | ||
113 | DECLARE_EVENT_TABLE() | |
114 | DECLARE_DYNAMIC_CLASS(wxGenericColourDialog) | |
115 | }; | |
116 | ||
117 | #endif // _WX_COLORDLGG_H_ |