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