]> git.saurik.com Git - wxWidgets.git/blob - interface/clrpicker.h
Minor doc corrections for [q-r] in ticket #9581 (most of the patch was applied alread...
[wxWidgets.git] / interface / clrpicker.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: clrpicker.h
3 // Purpose: interface of wxColourPickerCtrl
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxColourPickerCtrl
11 @wxheader{clrpicker.h}
12
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).
18
19 @beginStyleTable
20 @style{wxCLRP_DEFAULT_STYLE}
21 The default style: 0.
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).
31 @endStyleTable
32
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,
38 i.e. recognizable).
39 @endEventTable
40
41 @library{wxcore}
42 @category{pickers}
43 <!-- @appearance{colourpickerctrl.png} -->
44
45 @see wxColourDialog, wxColourPickerEvent
46 */
47 class wxColourPickerCtrl : public wxPickerBase
48 {
49 public:
50 /**
51 Initializes the object and calls Create() with all the parameters.
52 */
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");
60
61 /**
62 Creates a colour picker with the given arguments.
63
64 @param parent
65 Parent window, must not be non-@NULL.
66 @param id
67 The identifier for the control.
68 @param colour
69 The initial colour shown in the control.
70 @param pos
71 Initial position.
72 @param size
73 Initial size.
74 @param style
75 The window style, see wxCRLP_* flags.
76 @param validator
77 Validator which can be used for additional date checks.
78 @param name
79 Control name.
80
81 @return @true if the control was successfully created or @false if
82 creation failed.
83 */
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");
91
92 /**
93 Returns the currently selected colour.
94 */
95 wxColour GetColour() const;
96
97 //@{
98 /**
99 Sets the currently selected colour. See wxColour::Set().
100 */
101 void SetColour(const wxColour& col);
102 void SetColour(const wxString& colname);
103 //@}
104 };
105
106
107
108 /**
109 @class wxColourPickerEvent
110 @wxheader{clrpicker.h}
111
112 This event class is used for the events generated by wxColourPickerCtrl.
113
114 @beginEventTable{wxColourPickerEvent}
115 @event{EVT_COLOURPICKER_CHANGED(id, func)}
116 Generated whenever the selected colour changes.
117 @endEventTable
118
119 @library{wxcore}
120 @category{events}
121
122 @see wxColourPickerCtrl
123 */
124 class wxColourPickerEvent : public wxCommandEvent
125 {
126 public:
127 /**
128 The constructor is not normally used by the user code.
129 */
130 wxColourPickerEvent(wxObject* generator, int id,
131 const wxColour& colour);
132
133 /**
134 Retrieve the colour the user has just selected.
135 */
136 wxColour GetColour() const;
137
138 /**
139 Set the colour associated with the event.
140 */
141 void SetColour(const wxColour& pos);
142 };
143