]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/clrpicker.h
Better document wxAutomationObject::GetDispatchPtr() return value.
[wxWidgets.git] / interface / wx / clrpicker.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: clrpicker.h
e54c96f1 3// Purpose: interface of wxColourPickerCtrl
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxColourPickerCtrl
7c913512 11
d18d9f60
BP
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).
7c913512 17
23324ae1 18 @beginStyleTable
8c6791e4 19 @style{wxCLRP_DEFAULT_STYLE}
23324ae1 20 The default style: 0.
8c6791e4 21 @style{wxCLRP_USE_TEXTCTRL}
23324ae1
FM
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.
8c6791e4 27 @style{wxCLRP_SHOW_LABEL}
23324ae1
FM
28 Shows the colour in HTML form (AABBCC) as colour button label
29 (instead of no label at all).
30 @endStyleTable
7c913512 31
3051a44a 32 @beginEventEmissionTable{wxColourPickerEvent}
d18d9f60
BP
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,
37 i.e. recognizable).
38 @endEventTable
39
23324ae1 40 @library{wxcore}
d18d9f60 41 @category{pickers}
7e59b885 42 @appearance{colourpickerctrl.png}
7c913512 43
e54c96f1 44 @see wxColourDialog, wxColourPickerEvent
23324ae1
FM
45*/
46class wxColourPickerCtrl : public wxPickerBase
47{
48public:
49 /**
d18d9f60 50 Initializes the object and calls Create() with all the parameters.
23324ae1 51 */
4cc4bfaf 52 wxColourPickerCtrl(wxWindow* parent, wxWindowID id,
4707b84c 53 const wxColour& colour = *wxBLACK,
23324ae1
FM
54 const wxPoint& pos = wxDefaultPosition,
55 const wxSize& size = wxDefaultSize,
56 long style = wxCLRP_DEFAULT_STYLE,
57 const wxValidator& validator = wxDefaultValidator,
9d9c1c24 58 const wxString& name = wxColourPickerCtrlNameStr);
23324ae1
FM
59
60 /**
d18d9f60
BP
61 Creates a colour picker with the given arguments.
62
7c913512 63 @param parent
4cc4bfaf 64 Parent window, must not be non-@NULL.
7c913512 65 @param id
4cc4bfaf 66 The identifier for the control.
7c913512 67 @param colour
4cc4bfaf 68 The initial colour shown in the control.
7c913512 69 @param pos
4cc4bfaf 70 Initial position.
7c913512 71 @param size
4cc4bfaf 72 Initial size.
7c913512 73 @param style
4cc4bfaf 74 The window style, see wxCRLP_* flags.
7c913512 75 @param validator
4cc4bfaf 76 Validator which can be used for additional date checks.
7c913512 77 @param name
4cc4bfaf 78 Control name.
3c4f71cc 79
d29a9a8a
BP
80 @return @true if the control was successfully created or @false if
81 creation failed.
23324ae1 82 */
4cc4bfaf 83 bool Create(wxWindow* parent, wxWindowID id,
4707b84c 84 const wxColour& colour = *wxBLACK,
23324ae1
FM
85 const wxPoint& pos = wxDefaultPosition,
86 const wxSize& size = wxDefaultSize,
87 long style = wxCLRP_DEFAULT_STYLE,
88 const wxValidator& validator = wxDefaultValidator,
9d9c1c24 89 const wxString& name = wxColourPickerCtrlNameStr);
23324ae1
FM
90
91 /**
92 Returns the currently selected colour.
93 */
328f5751 94 wxColour GetColour() const;
23324ae1
FM
95
96 //@{
97 /**
d18d9f60 98 Sets the currently selected colour. See wxColour::Set().
23324ae1 99 */
4cc4bfaf
FM
100 void SetColour(const wxColour& col);
101 void SetColour(const wxString& colname);
23324ae1
FM
102 //@}
103};
104
105
e54c96f1 106
23324ae1
FM
107/**
108 @class wxColourPickerEvent
7c913512 109
d18d9f60
BP
110 This event class is used for the events generated by wxColourPickerCtrl.
111
112 @beginEventTable{wxColourPickerEvent}
113 @event{EVT_COLOURPICKER_CHANGED(id, func)}
114 Generated whenever the selected colour changes.
115 @endEventTable
7c913512 116
23324ae1 117 @library{wxcore}
d18d9f60 118 @category{events}
7c913512 119
e54c96f1 120 @see wxColourPickerCtrl
23324ae1
FM
121*/
122class wxColourPickerEvent : public wxCommandEvent
123{
124public:
125 /**
126 The constructor is not normally used by the user code.
127 */
4cc4bfaf 128 wxColourPickerEvent(wxObject* generator, int id,
23324ae1
FM
129 const wxColour& colour);
130
131 /**
132 Retrieve the colour the user has just selected.
133 */
328f5751 134 wxColour GetColour() const;
23324ae1
FM
135
136 /**
137 Set the colour associated with the event.
138 */
4cc4bfaf 139 void SetColour(const wxColour& pos);
23324ae1 140};
e54c96f1 141