1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxColourPickerCtrl
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
8 #define wxCLRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
9 #define wxCLRP_DEFAULT_STYLE 0
10 #define wxCLRP_SHOW_LABEL 0x0008
12 wxEventType wxEVT_COLOURPICKER_CHANGED
;
16 @class wxColourPickerCtrl
18 This control allows the user to select a colour. The generic implementation
19 is a button which brings up a wxColourDialog when clicked. Native
20 implementation may differ but this is usually a (small) widget which give
21 access to the colour-chooser dialog. It is only available if
22 @c wxUSE_COLOURPICKERCTRL is set to 1 (the default).
25 @style{wxCLRP_DEFAULT_STYLE}
27 @style{wxCLRP_USE_TEXTCTRL}
28 Creates a text control to the left of the picker button which is
29 completely managed by the wxColourPickerCtrl and which can be used
30 by the user to specify a colour (see SetColour). The text control
31 is automatically synchronized with button's value. Use functions
32 defined in wxPickerBase to modify the text control.
33 @style{wxCLRP_SHOW_LABEL}
34 Shows the colour in HTML form (AABBCC) as colour button label
35 (instead of no label at all).
38 @beginEventEmissionTable{wxColourPickerEvent}
39 @event{EVT_COLOURPICKER_CHANGED(id, func)}
40 The user changed the colour selected in the control either using the
41 button or using text control (see @c wxCLRP_USE_TEXTCTRL; note that
42 in this case the event is fired only if the user’s input is valid,
48 @appearance{colourpickerctrl}
50 @see wxColourDialog, wxColourPickerEvent
52 class wxColourPickerCtrl
: public wxPickerBase
58 Initializes the object and calls Create() with all the parameters.
60 wxColourPickerCtrl(wxWindow
* parent
, wxWindowID id
,
61 const wxColour
& colour
= *wxBLACK
,
62 const wxPoint
& pos
= wxDefaultPosition
,
63 const wxSize
& size
= wxDefaultSize
,
64 long style
= wxCLRP_DEFAULT_STYLE
,
65 const wxValidator
& validator
= wxDefaultValidator
,
66 const wxString
& name
= wxColourPickerCtrlNameStr
);
69 Creates a colour picker with the given arguments.
72 Parent window, must not be non-@NULL.
74 The identifier for the control.
76 The initial colour shown in the control.
82 The window style, see wxCRLP_* flags.
84 Validator which can be used for additional date checks.
88 @return @true if the control was successfully created or @false if
91 bool Create(wxWindow
* parent
, wxWindowID id
,
92 const wxColour
& colour
= *wxBLACK
,
93 const wxPoint
& pos
= wxDefaultPosition
,
94 const wxSize
& size
= wxDefaultSize
,
95 long style
= wxCLRP_DEFAULT_STYLE
,
96 const wxValidator
& validator
= wxDefaultValidator
,
97 const wxString
& name
= wxColourPickerCtrlNameStr
);
100 Returns the currently selected colour.
102 wxColour
GetColour() const;
106 Sets the currently selected colour. See wxColour::Set().
108 void SetColour(const wxColour
& col
);
109 void SetColour(const wxString
& colname
);
116 @class wxColourPickerEvent
118 This event class is used for the events generated by wxColourPickerCtrl.
120 @beginEventTable{wxColourPickerEvent}
121 @event{EVT_COLOURPICKER_CHANGED(id, func)}
122 Generated whenever the selected colour changes.
128 @see wxColourPickerCtrl
130 class wxColourPickerEvent
: public wxCommandEvent
133 wxColourPickerEvent();
136 The constructor is not normally used by the user code.
138 wxColourPickerEvent(wxObject
* generator
, int id
,
139 const wxColour
& colour
);
142 Retrieve the colour the user has just selected.
144 wxColour
GetColour() const;
147 Set the colour associated with the event.
149 void SetColour(const wxColour
& pos
);