]>
Commit | Line | Data |
---|---|---|
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 | ||
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). | |
17 | ||
18 | @beginStyleTable | |
19 | @style{wxCLRP_DEFAULT_STYLE} | |
20 | The default style: 0. | |
21 | @style{wxCLRP_USE_TEXTCTRL} | |
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. | |
27 | @style{wxCLRP_SHOW_LABEL} | |
28 | Shows the colour in HTML form (AABBCC) as colour button label | |
29 | (instead of no label at all). | |
30 | @endStyleTable | |
31 | ||
32 | @beginEventTable{wxColourPickerEvent} | |
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 | ||
40 | @library{wxcore} | |
41 | @category{pickers} | |
42 | @appearance{colourpickerctrl.png} | |
43 | ||
44 | @see wxColourDialog, wxColourPickerEvent | |
45 | */ | |
46 | class wxColourPickerCtrl : public wxPickerBase | |
47 | { | |
48 | public: | |
49 | /** | |
50 | Initializes the object and calls Create() with all the parameters. | |
51 | */ | |
52 | wxColourPickerCtrl(wxWindow* parent, wxWindowID id, | |
53 | const wxColour& colour = *wxBLACK, | |
54 | const wxPoint& pos = wxDefaultPosition, | |
55 | const wxSize& size = wxDefaultSize, | |
56 | long style = wxCLRP_DEFAULT_STYLE, | |
57 | const wxValidator& validator = wxDefaultValidator, | |
58 | const wxString& name = wxColourPickerCtrlNameStr); | |
59 | ||
60 | /** | |
61 | Creates a colour picker with the given arguments. | |
62 | ||
63 | @param parent | |
64 | Parent window, must not be non-@NULL. | |
65 | @param id | |
66 | The identifier for the control. | |
67 | @param colour | |
68 | The initial colour shown in the control. | |
69 | @param pos | |
70 | Initial position. | |
71 | @param size | |
72 | Initial size. | |
73 | @param style | |
74 | The window style, see wxCRLP_* flags. | |
75 | @param validator | |
76 | Validator which can be used for additional date checks. | |
77 | @param name | |
78 | Control name. | |
79 | ||
80 | @return @true if the control was successfully created or @false if | |
81 | creation failed. | |
82 | */ | |
83 | bool Create(wxWindow* parent, wxWindowID id, | |
84 | const wxColour& colour = *wxBLACK, | |
85 | const wxPoint& pos = wxDefaultPosition, | |
86 | const wxSize& size = wxDefaultSize, | |
87 | long style = wxCLRP_DEFAULT_STYLE, | |
88 | const wxValidator& validator = wxDefaultValidator, | |
89 | const wxString& name = wxColourPickerCtrlNameStr); | |
90 | ||
91 | /** | |
92 | Returns the currently selected colour. | |
93 | */ | |
94 | wxColour GetColour() const; | |
95 | ||
96 | //@{ | |
97 | /** | |
98 | Sets the currently selected colour. See wxColour::Set(). | |
99 | */ | |
100 | void SetColour(const wxColour& col); | |
101 | void SetColour(const wxString& colname); | |
102 | //@} | |
103 | }; | |
104 | ||
105 | ||
106 | ||
107 | /** | |
108 | @class wxColourPickerEvent | |
109 | ||
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 | |
116 | ||
117 | @library{wxcore} | |
118 | @category{events} | |
119 | ||
120 | @see wxColourPickerCtrl | |
121 | */ | |
122 | class wxColourPickerEvent : public wxCommandEvent | |
123 | { | |
124 | public: | |
125 | /** | |
126 | The constructor is not normally used by the user code. | |
127 | */ | |
128 | wxColourPickerEvent(wxObject* generator, int id, | |
129 | const wxColour& colour); | |
130 | ||
131 | /** | |
132 | Retrieve the colour the user has just selected. | |
133 | */ | |
134 | wxColour GetColour() const; | |
135 | ||
136 | /** | |
137 | Set the colour associated with the event. | |
138 | */ | |
139 | void SetColour(const wxColour& pos); | |
140 | }; | |
141 |