]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/clrpicker.h
Correct the initial value setting in wxMSW wxSpinCtrl.
[wxWidgets.git] / interface / wx / clrpicker.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: clrpicker.h
3 // Purpose: interface of wxColourPickerCtrl
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 #define wxCLRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
10 #define wxCLRP_DEFAULT_STYLE 0
11 #define wxCLRP_SHOW_LABEL 0x0008
12
13 wxEventType wxEVT_COMMAND_COLOURPICKER_CHANGED;
14
15
16 /**
17 @class wxColourPickerCtrl
18
19 This control allows the user to select a colour. The generic implementation
20 is a button which brings up a wxColourDialog when clicked. Native
21 implementation may differ but this is usually a (small) widget which give
22 access to the colour-chooser dialog. It is only available if
23 @c wxUSE_COLOURPICKERCTRL is set to 1 (the default).
24
25 @beginStyleTable
26 @style{wxCLRP_DEFAULT_STYLE}
27 The default style: 0.
28 @style{wxCLRP_USE_TEXTCTRL}
29 Creates a text control to the left of the picker button which is
30 completely managed by the wxColourPickerCtrl and which can be used
31 by the user to specify a colour (see SetColour). The text control
32 is automatically synchronized with button's value. Use functions
33 defined in wxPickerBase to modify the text control.
34 @style{wxCLRP_SHOW_LABEL}
35 Shows the colour in HTML form (AABBCC) as colour button label
36 (instead of no label at all).
37 @endStyleTable
38
39 @beginEventEmissionTable{wxColourPickerEvent}
40 @event{EVT_COLOURPICKER_CHANGED(id, func)}
41 The user changed the colour selected in the control either using the
42 button or using text control (see @c wxCLRP_USE_TEXTCTRL; note that
43 in this case the event is fired only if the user’s input is valid,
44 i.e. recognizable).
45 @endEventTable
46
47 @library{wxcore}
48 @category{pickers}
49 @appearance{colourpickerctrl.png}
50
51 @see wxColourDialog, wxColourPickerEvent
52 */
53 class wxColourPickerCtrl : public wxPickerBase
54 {
55 public:
56 wxColourPickerCtrl();
57
58 /**
59 Initializes the object and calls Create() with all the parameters.
60 */
61 wxColourPickerCtrl(wxWindow* parent, wxWindowID id,
62 const wxColour& colour = *wxBLACK,
63 const wxPoint& pos = wxDefaultPosition,
64 const wxSize& size = wxDefaultSize,
65 long style = wxCLRP_DEFAULT_STYLE,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxColourPickerCtrlNameStr);
68
69 /**
70 Creates a colour picker with the given arguments.
71
72 @param parent
73 Parent window, must not be non-@NULL.
74 @param id
75 The identifier for the control.
76 @param colour
77 The initial colour shown in the control.
78 @param pos
79 Initial position.
80 @param size
81 Initial size.
82 @param style
83 The window style, see wxCRLP_* flags.
84 @param validator
85 Validator which can be used for additional date checks.
86 @param name
87 Control name.
88
89 @return @true if the control was successfully created or @false if
90 creation failed.
91 */
92 bool Create(wxWindow* parent, wxWindowID id,
93 const wxColour& colour = *wxBLACK,
94 const wxPoint& pos = wxDefaultPosition,
95 const wxSize& size = wxDefaultSize,
96 long style = wxCLRP_DEFAULT_STYLE,
97 const wxValidator& validator = wxDefaultValidator,
98 const wxString& name = wxColourPickerCtrlNameStr);
99
100 /**
101 Returns the currently selected colour.
102 */
103 wxColour GetColour() const;
104
105 //@{
106 /**
107 Sets the currently selected colour. See wxColour::Set().
108 */
109 void SetColour(const wxColour& col);
110 void SetColour(const wxString& colname);
111 //@}
112 };
113
114
115
116 /**
117 @class wxColourPickerEvent
118
119 This event class is used for the events generated by wxColourPickerCtrl.
120
121 @beginEventTable{wxColourPickerEvent}
122 @event{EVT_COLOURPICKER_CHANGED(id, func)}
123 Generated whenever the selected colour changes.
124 @endEventTable
125
126 @library{wxcore}
127 @category{events}
128
129 @see wxColourPickerCtrl
130 */
131 class wxColourPickerEvent : public wxCommandEvent
132 {
133 public:
134 wxColourPickerEvent();
135
136 /**
137 The constructor is not normally used by the user code.
138 */
139 wxColourPickerEvent(wxObject* generator, int id,
140 const wxColour& colour);
141
142 /**
143 Retrieve the colour the user has just selected.
144 */
145 wxColour GetColour() const;
146
147 /**
148 Set the colour associated with the event.
149 */
150 void SetColour(const wxColour& pos);
151 };
152