]> git.saurik.com Git - wxWidgets.git/blob - interface/clrpicker.h
1aa9f3b80d34e0a81c551709c1e20c2ddcf81423
[wxWidgets.git] / interface / clrpicker.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: clrpicker.h
3 // Purpose: documentation for wxColourPickerCtrl class
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 is
14 a button which brings up a wxColourDialog when clicked. Native implementation
15 may differ but this is usually a (small) widget which give access to the
16 colour-chooser
17 dialog.
18 It is only available if @c wxUSE_COLOURPICKERCTRL is set to 1 (the default).
19
20 @beginStyleTable
21 @style{wxCLRP_DEFAULT_STYLE}:
22 The default style: 0.
23 @style{wxCLRP_USE_TEXTCTRL}:
24 Creates a text control to the left of the picker button which is
25 completely managed by the wxColourPickerCtrl and which can be used
26 by the user to specify a colour (see SetColour). The text control
27 is automatically synchronized with button's value. Use functions
28 defined in wxPickerBase to modify the text control.
29 @style{wxCLRP_SHOW_LABEL}:
30 Shows the colour in HTML form (AABBCC) as colour button label
31 (instead of no label at all).
32 @endStyleTable
33
34 @library{wxcore}
35 @category{miscpickers}
36 @appearance{colourpickerctrl.png}
37
38 @seealso
39 wxColourDialog, wxColourPickerEvent
40 */
41 class wxColourPickerCtrl : public wxPickerBase
42 {
43 public:
44 /**
45 Initializes the object and calls Create() with
46 all the parameters.
47 */
48 wxColourPickerCtrl(wxWindow* parent, wxWindowID id,
49 const wxColour& colour = wxBLACK,
50 const wxPoint& pos = wxDefaultPosition,
51 const wxSize& size = wxDefaultSize,
52 long style = wxCLRP_DEFAULT_STYLE,
53 const wxValidator& validator = wxDefaultValidator,
54 const wxString& name = "colourpickerctrl");
55
56 /**
57 @param parent
58 Parent window, must not be non-@NULL.
59 @param id
60 The identifier for the control.
61 @param colour
62 The initial colour shown in the control.
63 @param pos
64 Initial position.
65 @param size
66 Initial size.
67 @param style
68 The window style, see wxCRLP_* flags.
69 @param validator
70 Validator which can be used for additional date checks.
71 @param name
72 Control name.
73
74 @returns @true if the control was successfully created or @false if
75 creation failed.
76 */
77 bool Create(wxWindow* parent, wxWindowID id,
78 const wxColour& colour = wxBLACK,
79 const wxPoint& pos = wxDefaultPosition,
80 const wxSize& size = wxDefaultSize,
81 long style = wxCLRP_DEFAULT_STYLE,
82 const wxValidator& validator = wxDefaultValidator,
83 const wxString& name = "colourpickerctrl");
84
85 /**
86 Returns the currently selected colour.
87 */
88 wxColour GetColour();
89
90 //@{
91 /**
92 Sets the currently selected colour. See wxColour::Set.
93 */
94 void SetColour(const wxColour& col);
95 void SetColour(const wxString& colname);
96 //@}
97 };
98
99
100 /**
101 @class wxColourPickerEvent
102 @wxheader{clrpicker.h}
103
104 This event class is used for the events generated by
105 wxColourPickerCtrl.
106
107 @library{wxcore}
108 @category{FIXME}
109
110 @seealso
111 wxColourPickerCtrl
112 */
113 class wxColourPickerEvent : public wxCommandEvent
114 {
115 public:
116 /**
117 The constructor is not normally used by the user code.
118 */
119 wxColourPickerEvent(wxObject* generator, int id,
120 const wxColour& colour);
121
122 /**
123 Retrieve the colour the user has just selected.
124 */
125 wxColour GetColour();
126
127 /**
128 Set the colour associated with the event.
129 */
130 void SetColour(const wxColour& pos);
131 };