1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxColourPickerCtrl
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
9 #define wxCLRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
10 #define wxCLRP_DEFAULT_STYLE 0
11 #define wxCLRP_SHOW_LABEL 0x0008
13 wxEventType wxEVT_COLOURPICKER_CHANGED
;
17 @class wxColourPickerCtrl
19 This control allows the user to select a colour. The generic implementation
20 is a button which brings up a wxColourDialog when clicked. Native
21 implementation may differ but this is usually a (small) widget which give
22 access to the colour-chooser dialog. It is only available if
23 @c wxUSE_COLOURPICKERCTRL is set to 1 (the default).
26 @style{wxCLRP_DEFAULT_STYLE}
28 @style{wxCLRP_USE_TEXTCTRL}
29 Creates a text control to the left of the picker button which is
30 completely managed by the wxColourPickerCtrl and which can be used
31 by the user to specify a colour (see SetColour). The text control
32 is automatically synchronized with button's value. Use functions
33 defined in wxPickerBase to modify the text control.
34 @style{wxCLRP_SHOW_LABEL}
35 Shows the colour in HTML form (AABBCC) as colour button label
36 (instead of no label at all).
39 @beginEventEmissionTable{wxColourPickerEvent}
40 @event{EVT_COLOURPICKER_CHANGED(id, func)}
41 The user changed the colour selected in the control either using the
42 button or using text control (see @c wxCLRP_USE_TEXTCTRL; note that
43 in this case the event is fired only if the user’s input is valid,
49 @appearance{colourpickerctrl}
51 @see wxColourDialog, wxColourPickerEvent
53 class wxColourPickerCtrl
: public wxPickerBase
59 Initializes the object and calls Create() with all the parameters.
61 wxColourPickerCtrl(wxWindow
* parent
, wxWindowID id
,
62 const wxColour
& colour
= *wxBLACK
,
63 const wxPoint
& pos
= wxDefaultPosition
,
64 const wxSize
& size
= wxDefaultSize
,
65 long style
= wxCLRP_DEFAULT_STYLE
,
66 const wxValidator
& validator
= wxDefaultValidator
,
67 const wxString
& name
= wxColourPickerCtrlNameStr
);
70 Creates a colour picker with the given arguments.
73 Parent window, must not be non-@NULL.
75 The identifier for the control.
77 The initial colour shown in the control.
83 The window style, see wxCRLP_* flags.
85 Validator which can be used for additional date checks.
89 @return @true if the control was successfully created or @false if
92 bool Create(wxWindow
* parent
, wxWindowID id
,
93 const wxColour
& colour
= *wxBLACK
,
94 const wxPoint
& pos
= wxDefaultPosition
,
95 const wxSize
& size
= wxDefaultSize
,
96 long style
= wxCLRP_DEFAULT_STYLE
,
97 const wxValidator
& validator
= wxDefaultValidator
,
98 const wxString
& name
= wxColourPickerCtrlNameStr
);
101 Returns the currently selected colour.
103 wxColour
GetColour() const;
107 Sets the currently selected colour. See wxColour::Set().
109 void SetColour(const wxColour
& col
);
110 void SetColour(const wxString
& colname
);
117 @class wxColourPickerEvent
119 This event class is used for the events generated by wxColourPickerCtrl.
121 @beginEventTable{wxColourPickerEvent}
122 @event{EVT_COLOURPICKER_CHANGED(id, func)}
123 Generated whenever the selected colour changes.
129 @see wxColourPickerCtrl
131 class wxColourPickerEvent
: public wxCommandEvent
134 wxColourPickerEvent();
137 The constructor is not normally used by the user code.
139 wxColourPickerEvent(wxObject
* generator
, int id
,
140 const wxColour
& colour
);
143 Retrieve the colour the user has just selected.
145 wxColour
GetColour() const;
148 Set the colour associated with the event.
150 void SetColour(const wxColour
& pos
);