]> git.saurik.com Git - wxWidgets.git/blob - interface/clrpicker.h
Call ValueChanged after SetValue so other views will be updated
[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 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 @see wxColourDialog, wxColourPickerEvent
39 */
40 class wxColourPickerCtrl : public wxPickerBase
41 {
42 public:
43 /**
44 Initializes the object and calls Create() with
45 all the parameters.
46 */
47 wxColourPickerCtrl(wxWindow* parent, wxWindowID id,
48 const wxColour& colour = wxBLACK,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
51 long style = wxCLRP_DEFAULT_STYLE,
52 const wxValidator& validator = wxDefaultValidator,
53 const wxString& name = "colourpickerctrl");
54
55 /**
56 @param parent
57 Parent window, must not be non-@NULL.
58 @param id
59 The identifier for the control.
60 @param colour
61 The initial colour shown in the control.
62 @param pos
63 Initial position.
64 @param size
65 Initial size.
66 @param style
67 The window style, see wxCRLP_* flags.
68 @param validator
69 Validator which can be used for additional date checks.
70 @param name
71 Control name.
72
73 @returns @true if the control was successfully created or @false if
74 creation failed.
75 */
76 bool Create(wxWindow* parent, wxWindowID id,
77 const wxColour& colour = wxBLACK,
78 const wxPoint& pos = wxDefaultPosition,
79 const wxSize& size = wxDefaultSize,
80 long style = wxCLRP_DEFAULT_STYLE,
81 const wxValidator& validator = wxDefaultValidator,
82 const wxString& name = "colourpickerctrl");
83
84 /**
85 Returns the currently selected colour.
86 */
87 wxColour GetColour() const;
88
89 //@{
90 /**
91 Sets the currently selected colour. See wxColour::Set.
92 */
93 void SetColour(const wxColour& col);
94 void SetColour(const wxString& colname);
95 //@}
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 @see wxColourPickerCtrl
111 */
112 class wxColourPickerEvent : public wxCommandEvent
113 {
114 public:
115 /**
116 The constructor is not normally used by the user code.
117 */
118 wxColourPickerEvent(wxObject* generator, int id,
119 const wxColour& colour);
120
121 /**
122 Retrieve the colour the user has just selected.
123 */
124 wxColour GetColour() const;
125
126 /**
127 Set the colour associated with the event.
128 */
129 void SetColour(const wxColour& pos);
130 };
131