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