This control allows the user to select a colour. The generic implementation is a button which brings up a wxColourDialog when clicked. Native implementation may differ but this is usually a (small) widget which give access to the colour-chooser dialog. It is only available if wxUSE_COLOURPICKERCTRL is set to 1 (the default).
Derived from
wxPickerBase
wxControl
wxWindow
wxEvtHandler
wxObject
Include files
<wx/clrpicker.h>
Window styles
wxCLRP_DEFAULT_STYLE | The default style: 0. |
wxCLRP_USE_TEXTCTRL | Creates a text control to the left of the picker button which is completely managed by the wxColourPickerCtrl and which can be used by the user to specify a colour (see SetColour). The text control is automatically synchronized with button's value. Use functions defined in wxPickerBase to modify the text control. |
wxCLRP_SHOW_LABEL | Shows the colour in HTML form (AABBCC) as colour button label (instead of no label at all). |
Event handling
To process a colour picker event, use these event handler macros to direct input to member functions that take a wxColourPickerEvent argument.
EVT_COLOURPICKER_CHANGED(id, func) | The user changed the colour selected in the control either using the button or using text control (see wxCLRP_USE_TEXTCTRL; note that in this case the event is fired only if the user's input is valid, i.e. recognizable). |
See also
wxColourDialog,
wxColourPickerEvent
Members
wxColourPickerCtrl::wxColourPickerCtrl
wxColourPickerCtrl::Create
wxColourPickerCtrl::GetColour
wxColourPickerCtrl::SetColour
wxColourPickerCtrl(wxWindow *parent, wxWindowID id, const wxColour& colour = *wxBLACK, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = "colourpickerctrl")
Initializes the object and calls Create with all the parameters.
bool Create(wxWindow *parent, wxWindowID id, const wxColour& colour = *wxBLACK, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = "colourpickerctrl")
Parameters
parent
id
colour
pos
size
style
validator
name
Return value
true if the control was successfully created or false if creation failed.
wxColour GetColour() const
Returns the currently selected colour.
void SetColour(const wxColour &col)
void SetColour(const wxString &colname)
Sets the currently selected colour. See wxColour::Set.