]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: clrpicker.h | |
e54c96f1 | 3 | // Purpose: interface of wxColourPickerCtrl |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxColourPickerCtrl | |
11 | @wxheader{clrpicker.h} | |
7c913512 | 12 | |
d18d9f60 BP |
13 | This control allows the user to select a colour. The generic implementation |
14 | is a button which brings up a wxColourDialog when clicked. Native | |
15 | implementation may differ but this is usually a (small) widget which give | |
16 | access to the colour-chooser dialog. It is only available if | |
17 | @c wxUSE_COLOURPICKERCTRL is set to 1 (the default). | |
7c913512 | 18 | |
23324ae1 | 19 | @beginStyleTable |
8c6791e4 | 20 | @style{wxCLRP_DEFAULT_STYLE} |
23324ae1 | 21 | The default style: 0. |
8c6791e4 | 22 | @style{wxCLRP_USE_TEXTCTRL} |
23324ae1 FM |
23 | Creates a text control to the left of the picker button which is |
24 | completely managed by the wxColourPickerCtrl and which can be used | |
25 | by the user to specify a colour (see SetColour). The text control | |
26 | is automatically synchronized with button's value. Use functions | |
27 | defined in wxPickerBase to modify the text control. | |
8c6791e4 | 28 | @style{wxCLRP_SHOW_LABEL} |
23324ae1 FM |
29 | Shows the colour in HTML form (AABBCC) as colour button label |
30 | (instead of no label at all). | |
31 | @endStyleTable | |
7c913512 | 32 | |
d18d9f60 BP |
33 | @beginEventTable{wxColourPickerEvent} |
34 | @event{EVT_COLOURPICKER_CHANGED(id, func)} | |
35 | The user changed the colour selected in the control either using the | |
36 | button or using text control (see @c wxCLRP_USE_TEXTCTRL; note that | |
37 | in this case the event is fired only if the user’s input is valid, | |
38 | i.e. recognizable). | |
39 | @endEventTable | |
40 | ||
23324ae1 | 41 | @library{wxcore} |
d18d9f60 BP |
42 | @category{pickers} |
43 | <!-- @appearance{colourpickerctrl.png} --> | |
7c913512 | 44 | |
e54c96f1 | 45 | @see wxColourDialog, wxColourPickerEvent |
23324ae1 FM |
46 | */ |
47 | class wxColourPickerCtrl : public wxPickerBase | |
48 | { | |
49 | public: | |
50 | /** | |
d18d9f60 | 51 | Initializes the object and calls Create() with all the parameters. |
23324ae1 | 52 | */ |
4cc4bfaf | 53 | wxColourPickerCtrl(wxWindow* parent, wxWindowID id, |
23324ae1 FM |
54 | const wxColour& colour = wxBLACK, |
55 | const wxPoint& pos = wxDefaultPosition, | |
56 | const wxSize& size = wxDefaultSize, | |
57 | long style = wxCLRP_DEFAULT_STYLE, | |
58 | const wxValidator& validator = wxDefaultValidator, | |
59 | const wxString& name = "colourpickerctrl"); | |
60 | ||
61 | /** | |
d18d9f60 BP |
62 | Creates a colour picker with the given arguments. |
63 | ||
7c913512 | 64 | @param parent |
4cc4bfaf | 65 | Parent window, must not be non-@NULL. |
7c913512 | 66 | @param id |
4cc4bfaf | 67 | The identifier for the control. |
7c913512 | 68 | @param colour |
4cc4bfaf | 69 | The initial colour shown in the control. |
7c913512 | 70 | @param pos |
4cc4bfaf | 71 | Initial position. |
7c913512 | 72 | @param size |
4cc4bfaf | 73 | Initial size. |
7c913512 | 74 | @param style |
4cc4bfaf | 75 | The window style, see wxCRLP_* flags. |
7c913512 | 76 | @param validator |
4cc4bfaf | 77 | Validator which can be used for additional date checks. |
7c913512 | 78 | @param name |
4cc4bfaf | 79 | Control name. |
3c4f71cc | 80 | |
23324ae1 | 81 | @returns @true if the control was successfully created or @false if |
4cc4bfaf | 82 | creation failed. |
23324ae1 | 83 | */ |
4cc4bfaf | 84 | bool Create(wxWindow* parent, wxWindowID id, |
23324ae1 FM |
85 | const wxColour& colour = wxBLACK, |
86 | const wxPoint& pos = wxDefaultPosition, | |
87 | const wxSize& size = wxDefaultSize, | |
88 | long style = wxCLRP_DEFAULT_STYLE, | |
89 | const wxValidator& validator = wxDefaultValidator, | |
90 | const wxString& name = "colourpickerctrl"); | |
91 | ||
92 | /** | |
93 | Returns the currently selected colour. | |
94 | */ | |
328f5751 | 95 | wxColour GetColour() const; |
23324ae1 FM |
96 | |
97 | //@{ | |
98 | /** | |
d18d9f60 | 99 | Sets the currently selected colour. See wxColour::Set(). |
23324ae1 | 100 | */ |
4cc4bfaf FM |
101 | void SetColour(const wxColour& col); |
102 | void SetColour(const wxString& colname); | |
23324ae1 FM |
103 | //@} |
104 | }; | |
105 | ||
106 | ||
e54c96f1 | 107 | |
23324ae1 FM |
108 | /** |
109 | @class wxColourPickerEvent | |
110 | @wxheader{clrpicker.h} | |
7c913512 | 111 | |
d18d9f60 BP |
112 | This event class is used for the events generated by wxColourPickerCtrl. |
113 | ||
114 | @beginEventTable{wxColourPickerEvent} | |
115 | @event{EVT_COLOURPICKER_CHANGED(id, func)} | |
116 | Generated whenever the selected colour changes. | |
117 | @endEventTable | |
7c913512 | 118 | |
23324ae1 | 119 | @library{wxcore} |
d18d9f60 | 120 | @category{events} |
7c913512 | 121 | |
e54c96f1 | 122 | @see wxColourPickerCtrl |
23324ae1 FM |
123 | */ |
124 | class wxColourPickerEvent : public wxCommandEvent | |
125 | { | |
126 | public: | |
127 | /** | |
128 | The constructor is not normally used by the user code. | |
129 | */ | |
4cc4bfaf | 130 | wxColourPickerEvent(wxObject* generator, int id, |
23324ae1 FM |
131 | const wxColour& colour); |
132 | ||
133 | /** | |
134 | Retrieve the colour the user has just selected. | |
135 | */ | |
328f5751 | 136 | wxColour GetColour() const; |
23324ae1 FM |
137 | |
138 | /** | |
139 | Set the colour associated with the event. | |
140 | */ | |
4cc4bfaf | 141 | void SetColour(const wxColour& pos); |
23324ae1 | 142 | }; |
e54c96f1 | 143 |