contents up previous next

wxcolourpickerctrl

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::wxcolourpickerctrl

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.


wxcolourpickerctrl::create

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.


wxcolourpickerctrl::getcolour

wxcolour getcolour() const

returns the currently selected colour.


wxcolourpickerctrl::setcolour

void setcolour(const wxcolour &col)

void setcolour(const wxstring &colname)

sets the currently selected colour. see wxcolour::set.