]>
git.saurik.com Git - wxWidgets.git/blob - interface/clrpicker.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxColourPickerCtrl
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxColourPickerCtrl
11 @wxheader{clrpicker.h}
13 This control allows the user to select a colour. The generic implementation
14 is a button which brings up a wxColourDialog when clicked. Native
15 implementation may differ but this is usually a (small) widget which give
16 access to the colour-chooser dialog. It is only available if
17 @c wxUSE_COLOURPICKERCTRL is set to 1 (the default).
20 @style{wxCLRP_DEFAULT_STYLE}
22 @style{wxCLRP_USE_TEXTCTRL}
23 Creates a text control to the left of the picker button which is
24 completely managed by the wxColourPickerCtrl and which can be used
25 by the user to specify a colour (see SetColour). The text control
26 is automatically synchronized with button's value. Use functions
27 defined in wxPickerBase to modify the text control.
28 @style{wxCLRP_SHOW_LABEL}
29 Shows the colour in HTML form (AABBCC) as colour button label
30 (instead of no label at all).
33 @beginEventTable{wxColourPickerEvent}
34 @event{EVT_COLOURPICKER_CHANGED(id, func)}
35 The user changed the colour selected in the control either using the
36 button or using text control (see @c wxCLRP_USE_TEXTCTRL; note that
37 in this case the event is fired only if the user’s input is valid,
43 <!-- @appearance{colourpickerctrl.png} -->
45 @see wxColourDialog, wxColourPickerEvent
47 class wxColourPickerCtrl
: public wxPickerBase
51 Initializes the object and calls Create() with all the parameters.
53 wxColourPickerCtrl(wxWindow
* parent
, wxWindowID id
,
54 const wxColour
& colour
= wxBLACK
,
55 const wxPoint
& pos
= wxDefaultPosition
,
56 const wxSize
& size
= wxDefaultSize
,
57 long style
= wxCLRP_DEFAULT_STYLE
,
58 const wxValidator
& validator
= wxDefaultValidator
,
59 const wxString
& name
= "colourpickerctrl");
62 Creates a colour picker with the given arguments.
65 Parent window, must not be non-@NULL.
67 The identifier for the control.
69 The initial colour shown in the control.
75 The window style, see wxCRLP_* flags.
77 Validator which can be used for additional date checks.
81 @returns @true if the control was successfully created or @false if
84 bool Create(wxWindow
* parent
, wxWindowID id
,
85 const wxColour
& colour
= wxBLACK
,
86 const wxPoint
& pos
= wxDefaultPosition
,
87 const wxSize
& size
= wxDefaultSize
,
88 long style
= wxCLRP_DEFAULT_STYLE
,
89 const wxValidator
& validator
= wxDefaultValidator
,
90 const wxString
& name
= "colourpickerctrl");
93 Returns the currently selected colour.
95 wxColour
GetColour() const;
99 Sets the currently selected colour. See wxColour::Set().
101 void SetColour(const wxColour
& col
);
102 void SetColour(const wxString
& colname
);
109 @class wxColourPickerEvent
110 @wxheader{clrpicker.h}
112 This event class is used for the events generated by wxColourPickerCtrl.
114 @beginEventTable{wxColourPickerEvent}
115 @event{EVT_COLOURPICKER_CHANGED(id, func)}
116 Generated whenever the selected colour changes.
122 @see wxColourPickerCtrl
124 class wxColourPickerEvent
: public wxCommandEvent
128 The constructor is not normally used by the user code.
130 wxColourPickerEvent(wxObject
* generator
, int id
,
131 const wxColour
& colour
);
134 Retrieve the colour the user has just selected.
136 wxColour
GetColour() const;
139 Set the colour associated with the event.
141 void SetColour(const wxColour
& pos
);