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