]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxColour}}\label{wxcolour} |
2 | ||
3 | A colour is an object representing a combination of Red, Green, and Blue (RGB) intensity values, | |
4 | and is used to determine drawing colours. See the | |
5 | entry for \helpref{wxColourDatabase}{wxcolourdatabase} for how a pointer to a predefined, | |
6 | named colour may be returned instead of creating a new colour. | |
7 | ||
8 | Valid RGB values are in the range 0 to 255. | |
9 | ||
8161ba08 JS |
10 | You can retrieve the current system colour settings with \helpref{wxSystemSettings}{wxsystemsettings}. |
11 | ||
a660d684 KB |
12 | \wxheading{Derived from} |
13 | ||
14 | \helpref{wxObject}{wxobject} | |
15 | ||
954b8ae6 JS |
16 | \wxheading{Include files} |
17 | ||
18 | <wx/colour.h> | |
19 | ||
20e85460 JS |
20 | \wxheading{Predefined objects} |
21 | ||
22 | Objects: | |
23 | ||
24 | {\bf wxNullColour} | |
25 | ||
26 | Pointers: | |
27 | ||
28 | {\bf wxBLACK\\ | |
29 | wxWHITE\\ | |
30 | wxRED\\ | |
31 | wxBLUE\\ | |
32 | wxGREEN\\ | |
33 | wxCYAN\\ | |
34 | wxLIGHT\_GREY} | |
35 | ||
a660d684 KB |
36 | \wxheading{See also} |
37 | ||
38 | \helpref{wxColourDatabase}{wxcolourdatabase}, \helpref{wxPen}{wxpen}, \helpref{wxBrush}{wxbrush},\rtfsp | |
8161ba08 | 39 | \helpref{wxColourDialog}{wxcolourdialog}, \helpref{wxSystemSettings}{wxsystemsettings} |
a660d684 KB |
40 | |
41 | \latexignore{\rtfignore{\wxheading{Members}}} | |
42 | ||
c50f92d0 | 43 | |
a660d684 KB |
44 | \membersection{wxColour::wxColour}\label{wxcolourconstr} |
45 | ||
46 | \func{}{wxColour}{\void} | |
47 | ||
48 | Default constructor. | |
49 | ||
50 | \func{}{wxColour}{\param{const unsigned char}{ red}, \param{const unsigned char}{ green}, \param{const unsigned char}{ blue}} | |
51 | ||
52 | Constructs a colour from red, green and blue values. | |
53 | ||
54 | \func{}{wxColour}{\param{const wxString\& }{colourNname}} | |
55 | ||
56 | Constructs a colour object using a colour name | |
57 | listed in {\bf wxTheColourDatabase}. | |
58 | ||
1e6d9499 JS |
59 | \func{}{wxColour}{\param{const wxColour\&}{ colour}} |
60 | ||
61 | Copy constructor. | |
62 | ||
a660d684 KB |
63 | \wxheading{Parameters} |
64 | ||
65 | \docparam{red}{The red value.} | |
66 | ||
67 | \docparam{green}{The green value.} | |
68 | ||
69 | \docparam{blue}{The blue value.} | |
70 | ||
71 | \docparam{colourName}{The colour name.} | |
72 | ||
1e6d9499 JS |
73 | \docparam{colour}{The colour to copy.} |
74 | ||
a660d684 KB |
75 | \wxheading{See also} |
76 | ||
77 | \helpref{wxColourDatabase}{wxcolourdatabase} | |
78 | ||
06d20283 RD |
79 | \pythonnote{Constructors supported by wxPython are:\par |
80 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
81 | \twocolitem{{\bf wxColour(red=0, green=0, blue=0)}}{} |
82 | \twocolitem{{\bf wxNamedColour(name)}}{} | |
06d20283 RD |
83 | \end{twocollist}} |
84 | } | |
85 | ||
86 | ||
c50f92d0 | 87 | |
a660d684 KB |
88 | \membersection{wxColour::Blue}\label{wxcolourblue} |
89 | ||
90 | \constfunc{unsigned char}{Blue}{\void} | |
91 | ||
92 | Returns the blue intensity. | |
93 | ||
c50f92d0 | 94 | |
a660d684 KB |
95 | \membersection{wxColour::GetPixel}\label{wxcolourgetpixel} |
96 | ||
97 | \constfunc{long}{GetPixel}{\void} | |
98 | ||
99 | Returns a pixel value which is platform-dependent. On Windows, a COLORREF is returned. | |
100 | On X, an allocated pixel value is returned. | |
101 | ||
102 | -1 is returned if the pixel is invalid (on X, unallocated). | |
103 | ||
c50f92d0 | 104 | |
a660d684 KB |
105 | \membersection{wxColour::Green}\label{wxcolourgreen} |
106 | ||
107 | \constfunc{unsigned char}{Green}{\void} | |
108 | ||
109 | Returns the green intensity. | |
110 | ||
c50f92d0 | 111 | |
a660d684 KB |
112 | \membersection{wxColour::Ok}\label{wxcolourok} |
113 | ||
114 | \constfunc{bool}{Ok}{\void} | |
115 | ||
c50f92d0 VZ |
116 | Returns \true if the colour object is valid (the colour has been initialised with RGB values). |
117 | ||
a660d684 KB |
118 | |
119 | \membersection{wxColour::Red}\label{wxcolourred} | |
120 | ||
121 | \constfunc{unsigned char}{Red}{\void} | |
122 | ||
123 | Returns the red intensity. | |
124 | ||
c50f92d0 | 125 | |
a660d684 KB |
126 | \membersection{wxColour::Set}\label{wxcolourset} |
127 | ||
128 | \func{void}{Set}{\param{const unsigned char}{ red}, \param{const unsigned char}{ green}, \param{const unsigned char}{ blue}} | |
129 | ||
130 | Sets the RGB intensity values. | |
131 | ||
c50f92d0 | 132 | |
a660d684 KB |
133 | \membersection{wxColour::operator $=$}\label{wxcolourassign} |
134 | ||
135 | \func{wxColour\&}{operator $=$}{\param{const wxColour\&}{ colour}} | |
136 | ||
137 | Assignment operator, taking another colour object. | |
138 | ||
139 | \func{wxColour\&}{operator $=$}{\param{const wxString\&}{ colourName}} | |
140 | ||
141 | Assignment operator, using a colour name to be found in the colour database. | |
142 | ||
143 | \wxheading{See also} | |
144 | ||
145 | \helpref{wxColourDatabase}{wxcolourdatabase} | |
146 | ||
c50f92d0 | 147 | |
a660d684 KB |
148 | \membersection{wxColour::operator $==$}\label{wxcolourequality} |
149 | ||
150 | \func{bool}{operator $==$}{\param{const wxColour\&}{ colour}} | |
151 | ||
152 | Tests the equality of two colours by comparing individual red, green blue colours. | |
153 | ||
c50f92d0 | 154 | |
a660d684 KB |
155 | \membersection{wxColour::operator $!=$}\label{wxcolourinequality} |
156 | ||
157 | \func{bool}{operator $!=$}{\param{const wxColour\&}{ colour}} | |
158 | ||
159 | Tests the inequality of two colours by comparing individual red, green blue colours. | |
160 | ||
a660d684 KB |
161 | \section{\class{wxColourData}}\label{wxcolourdata} |
162 | ||
163 | This class holds a variety of information related to colour dialogs. | |
164 | ||
165 | \wxheading{Derived from} | |
166 | ||
167 | \helpref{wxObject}{wxobject} | |
168 | ||
954b8ae6 JS |
169 | \wxheading{Include files} |
170 | ||
171 | <wx/cmndata.h> | |
172 | ||
a660d684 KB |
173 | \wxheading{See also} |
174 | ||
175 | \helpref{wxColour}{wxcolour}, \helpref{wxColourDialog}{wxcolourdialog}, \helpref{wxColourDialog overview}{wxcolourdialogoverview} | |
176 | ||
177 | \latexignore{\rtfignore{\wxheading{Members}}} | |
178 | ||
c50f92d0 | 179 | |
a660d684 KB |
180 | \membersection{wxColourData::wxColourData}\label{wxcolourdataconstr} |
181 | ||
182 | \func{}{wxColourData}{\void} | |
183 | ||
184 | Constructor. Initializes the custom colours to white, the {\it data colour} setting | |
cc81d32f | 185 | to black, and the {\it choose full} setting to true. |
a660d684 | 186 | |
c50f92d0 | 187 | |
a660d684 KB |
188 | \membersection{wxColourData::\destruct{wxColourData}} |
189 | ||
190 | \func{}{\destruct{wxColourData}}{\void} | |
191 | ||
192 | Destructor. | |
193 | ||
c50f92d0 | 194 | |
a660d684 KB |
195 | \membersection{wxColourData::GetChooseFull}\label{wxcolourdatagetchoosefull} |
196 | ||
197 | \constfunc{bool}{GetChooseFull}{\void} | |
198 | ||
199 | Under Windows, determines whether the Windows colour dialog will display the full dialog | |
200 | with custom colour selection controls. Has no meaning under other platforms. | |
201 | ||
cc81d32f | 202 | The default value is true. |
a660d684 | 203 | |
c50f92d0 | 204 | |
a660d684 KB |
205 | \membersection{wxColourData::GetColour}\label{wxcolourdatagetcolour} |
206 | ||
207 | \constfunc{wxColour\&}{GetColour}{\void} | |
208 | ||
209 | Gets the current colour associated with the colour dialog. | |
210 | ||
211 | The default colour is black. | |
212 | ||
c50f92d0 | 213 | |
a660d684 KB |
214 | \membersection{wxColourData::GetCustomColour}\label{wxcolourdatagetcustomcolour} |
215 | ||
eaaa6a06 | 216 | \constfunc{wxColour\&}{GetCustomColour}{\param{int}{ i}} |
a660d684 KB |
217 | |
218 | Gets the {\it i}th custom colour associated with the colour dialog. {\it i} should | |
219 | be an integer between 0 and 15. | |
220 | ||
221 | The default custom colours are all white. | |
222 | ||
c50f92d0 | 223 | |
a660d684 KB |
224 | \membersection{wxColourData::SetChooseFull}\label{wxcolourdatasetchoosefull} |
225 | ||
226 | \func{void}{SetChooseFull}{\param{const bool }{flag}} | |
227 | ||
228 | Under Windows, tells the Windows colour dialog to display the full dialog | |
229 | with custom colour selection controls. Under other platforms, has no effect. | |
230 | ||
cc81d32f | 231 | The default value is true. |
a660d684 | 232 | |
c50f92d0 | 233 | |
a660d684 KB |
234 | \membersection{wxColourData::SetColour}\label{wxcolourdatasetcolour} |
235 | ||
236 | \func{void}{SetColour}{\param{const wxColour\&}{ colour}} | |
237 | ||
238 | Sets the default colour for the colour dialog. | |
239 | ||
240 | The default colour is black. | |
241 | ||
c50f92d0 | 242 | |
a660d684 KB |
243 | \membersection{wxColourData::SetCustomColour}\label{wxcolourdatasetcustomcolour} |
244 | ||
f6bcfd97 | 245 | \func{void}{SetCustomColour}{\param{int}{ i}, \param{const wxColour\&}{ colour}} |
a660d684 KB |
246 | |
247 | Sets the {\it i}th custom colour for the colour dialog. {\it i} should | |
248 | be an integer between 0 and 15. | |
249 | ||
250 | The default custom colours are all white. | |
251 | ||
c50f92d0 | 252 | |
a660d684 KB |
253 | \membersection{wxColourData::operator $=$}\label{wxcolourdataassign} |
254 | ||
255 | \func{void}{operator $=$}{\param{const wxColourData\&}{ data}} | |
256 | ||
2edb0bde | 257 | Assignment operator for the colour data. |
a660d684 | 258 | |
c50f92d0 VZ |
259 | |
260 | ||
261 | ||
a660d684 KB |
262 | \section{\class{wxColourDatabase}}\label{wxcolourdatabase} |
263 | ||
fc2171bd | 264 | wxWidgets maintains a database of standard RGB colours for a predefined |
a660d684 | 265 | set of named colours (such as ``BLACK'', ``LIGHT GREY''). The |
c50f92d0 VZ |
266 | application may add to this set if desired by using |
267 | \helpref{AddColour}{wxcolourdatabaseaddcolour} and may use it to look up | |
268 | colours by names using \helpref{Find}{wxcolourdatabasefind} or find the names | |
269 | for the standard colour suing \helpref{FindName}{wxcolourdatabasefindname}. | |
270 | ||
271 | There is one predefined instance of this class called | |
272 | {\bf wxTheColourDatabase}. | |
a660d684 KB |
273 | |
274 | \wxheading{Derived from} | |
275 | ||
8f520a56 | 276 | None |
a660d684 | 277 | |
954b8ae6 JS |
278 | \wxheading{Include files} |
279 | ||
280 | <wx/gdicmn.h> | |
281 | ||
a660d684 KB |
282 | \wxheading{Remarks} |
283 | ||
c50f92d0 | 284 | The standard database contains at least the following colours: |
a660d684 KB |
285 | |
286 | AQUAMARINE, BLACK, BLUE, BLUE VIOLET, BROWN, CADET BLUE, CORAL, | |
287 | CORNFLOWER BLUE, CYAN, DARK GREY, DARK GREEN, DARK OLIVE GREEN, DARK | |
288 | ORCHID, DARK SLATE BLUE, DARK SLATE GREY DARK TURQUOISE, DIM GREY, | |
289 | FIREBRICK, FOREST GREEN, GOLD, GOLDENROD, GREY, GREEN, GREEN YELLOW, | |
290 | INDIAN RED, KHAKI, LIGHT BLUE, LIGHT GREY, LIGHT STEEL BLUE, LIME GREEN, | |
291 | MAGENTA, MAROON, MEDIUM AQUAMARINE, MEDIUM BLUE, MEDIUM FOREST GREEN, | |
292 | MEDIUM GOLDENROD, MEDIUM ORCHID, MEDIUM SEA GREEN, MEDIUM SLATE BLUE, | |
293 | MEDIUM SPRING GREEN, MEDIUM TURQUOISE, MEDIUM VIOLET RED, MIDNIGHT BLUE, | |
294 | NAVY, ORANGE, ORANGE RED, ORCHID, PALE GREEN, PINK, PLUM, PURPLE, RED, | |
295 | SALMON, SEA GREEN, SIENNA, SKY BLUE, SLATE BLUE, SPRING GREEN, STEEL | |
296 | BLUE, TAN, THISTLE, TURQUOISE, VIOLET, VIOLET RED, WHEAT, WHITE, YELLOW, | |
297 | YELLOW GREEN. | |
298 | ||
299 | \wxheading{See also} | |
300 | ||
301 | \helpref{wxColour}{wxcolour} | |
302 | ||
303 | \latexignore{\rtfignore{\wxheading{Members}}} | |
304 | ||
c50f92d0 | 305 | |
a660d684 KB |
306 | \membersection{wxColourDatabase::wxColourDatabase}\label{wxcolourdatabaseconstr} |
307 | ||
308 | \func{}{wxColourDatabase}{\void} | |
309 | ||
c50f92d0 VZ |
310 | Constructs the colour database. It will be initialized at the first use. |
311 | ||
a660d684 | 312 | |
8f520a56 MB |
313 | \membersection{wxColourDatabase::AddColour}\label{wxcolourdatabaseaddcolour} |
314 | ||
c50f92d0 VZ |
315 | \func{void}{AddColour}{\param{const wxString\& }{colourName}, \param{const wxColour\&}{colour}} |
316 | ||
8f520a56 MB |
317 | \func{void}{AddColour}{\param{const wxString\& }{colourName}, \param{wxColour* }{colour}} |
318 | ||
319 | Adds a colour to the database. If a colour with the same name already exists, | |
320 | it is replaced. | |
321 | ||
c50f92d0 | 322 | Please note that the overload taking a pointer is deprecated and will be |
fc2171bd | 323 | removed in the next wxWidgets version, please don't use it. |
c50f92d0 VZ |
324 | |
325 | ||
326 | \membersection{wxColourDatabase::Find}\label{wxcolourdatabasefind} | |
327 | ||
328 | \func{wxColour}{FindColour}{\param{const wxString\& }{colourName}} | |
329 | ||
330 | Finds a colour given the name. Returns an invalid colour object (that is, such | |
331 | that its \helpref{Ok()}{wxcolourok} method returns \false) if the colour wasn't | |
332 | found in the database. | |
333 | ||
334 | ||
a660d684 KB |
335 | \membersection{wxColourDatabase::FindColour}\label{wxcolourdatabasefindcolour} |
336 | ||
337 | \func{wxColour*}{FindColour}{\param{const wxString\& }{colourName}} | |
338 | ||
0fee8cc4 | 339 | Finds a colour given the name. Returns \tt{NULL} if not found or a pointer which |
c50f92d0 | 340 | must be deleted by the caller otherwise. |
a660d684 | 341 | |
c50f92d0 | 342 | Please note that this method is deprecated and will be removed in the next |
fc2171bd | 343 | wxWidgets version, please use \helpref{Find}{wxcolourdatabasefind} instead of |
c50f92d0 | 344 | it. |
a660d684 | 345 | |
a660d684 | 346 | |
c50f92d0 | 347 | \membersection{wxColourDatabase::FindName}\label{wxcolourdatabasefindname} |
a660d684 | 348 | |
c50f92d0 | 349 | \constfunc{wxString}{FindName}{\param{const wxColour\&}{ colour}} |
a660d684 | 350 | |
c50f92d0 VZ |
351 | Finds a colour name given the colour. Returns an empty string if the colour is |
352 | not found in the database. | |
a660d684 KB |
353 | |
354 |