1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxColourPickerCtrl
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxColourPickerCtrl
12 This control allows the user to select a colour. The generic implementation
13 is a button which brings up a wxColourDialog when clicked. Native
14 implementation may differ but this is usually a (small) widget which give
15 access to the colour-chooser dialog. It is only available if
16 @c wxUSE_COLOURPICKERCTRL is set to 1 (the default).
19 @style{wxCLRP_DEFAULT_STYLE}
21 @style{wxCLRP_USE_TEXTCTRL}
22 Creates a text control to the left of the picker button which is
23 completely managed by the wxColourPickerCtrl and which can be used
24 by the user to specify a colour (see SetColour). The text control
25 is automatically synchronized with button's value. Use functions
26 defined in wxPickerBase to modify the text control.
27 @style{wxCLRP_SHOW_LABEL}
28 Shows the colour in HTML form (AABBCC) as colour button label
29 (instead of no label at all).
32 @beginEventEmissionTable{wxColourPickerEvent}
33 @event{EVT_COLOURPICKER_CHANGED(id, func)}
34 The user changed the colour selected in the control either using the
35 button or using text control (see @c wxCLRP_USE_TEXTCTRL; note that
36 in this case the event is fired only if the user’s input is valid,
42 @appearance{colourpickerctrl.png}
44 @see wxColourDialog, wxColourPickerEvent
46 class wxColourPickerCtrl
: public wxPickerBase
50 Initializes the object and calls Create() with all the parameters.
52 wxColourPickerCtrl(wxWindow
* parent
, wxWindowID id
,
53 const wxColour
& colour
= *wxBLACK
,
54 const wxPoint
& pos
= wxDefaultPosition
,
55 const wxSize
& size
= wxDefaultSize
,
56 long style
= wxCLRP_DEFAULT_STYLE
,
57 const wxValidator
& validator
= wxDefaultValidator
,
58 const wxString
& name
= wxColourPickerCtrlNameStr
);
61 Creates a colour picker with the given arguments.
64 Parent window, must not be non-@NULL.
66 The identifier for the control.
68 The initial colour shown in the control.
74 The window style, see wxCRLP_* flags.
76 Validator which can be used for additional date checks.
80 @return @true if the control was successfully created or @false if
83 bool Create(wxWindow
* parent
, wxWindowID id
,
84 const wxColour
& colour
= *wxBLACK
,
85 const wxPoint
& pos
= wxDefaultPosition
,
86 const wxSize
& size
= wxDefaultSize
,
87 long style
= wxCLRP_DEFAULT_STYLE
,
88 const wxValidator
& validator
= wxDefaultValidator
,
89 const wxString
& name
= wxColourPickerCtrlNameStr
);
92 Returns the currently selected colour.
94 wxColour
GetColour() const;
98 Sets the currently selected colour. See wxColour::Set().
100 void SetColour(const wxColour
& col
);
101 void SetColour(const wxString
& colname
);
108 @class wxColourPickerEvent
110 This event class is used for the events generated by wxColourPickerCtrl.
112 @beginEventTable{wxColourPickerEvent}
113 @event{EVT_COLOURPICKER_CHANGED(id, func)}
114 Generated whenever the selected colour changes.
120 @see wxColourPickerCtrl
122 class wxColourPickerEvent
: public wxCommandEvent
126 The constructor is not normally used by the user code.
128 wxColourPickerEvent(wxObject
* generator
, int id
,
129 const wxColour
& colour
);
132 Retrieve the colour the user has just selected.
134 wxColour
GetColour() const;
137 Set the colour associated with the event.
139 void SetColour(const wxColour
& pos
);