]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/colour.tex
Applied patch [ 1284913 ] [DOC] Removes msw.staticbitmap.htclient from sysopt.tex
[wxWidgets.git] / docs / latex / wx / colour.tex
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
10 You can retrieve the current system colour settings with \helpref{wxSystemSettings}{wxsystemsettings}.
11
12 \wxheading{Derived from}
13
14 \helpref{wxObject}{wxobject}
15
16 \wxheading{Include files}
17
18 <wx/colour.h>
19
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
36 \wxheading{See also}
37
38 \helpref{wxColourDatabase}{wxcolourdatabase}, \helpref{wxPen}{wxpen}, \helpref{wxBrush}{wxbrush},\rtfsp
39 \helpref{wxColourDialog}{wxcolourdialog}, \helpref{wxSystemSettings}{wxsystemsettings}
40
41 \latexignore{\rtfignore{\wxheading{Members}}}
42
43
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
59 \func{}{wxColour}{\param{const wxColour\&}{ colour}}
60
61 Copy constructor.
62
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
73 \docparam{colour}{The colour to copy.}
74
75 \wxheading{See also}
76
77 \helpref{wxColourDatabase}{wxcolourdatabase}
78
79 \pythonnote{Constructors supported by wxPython are:\par
80 \indented{2cm}{\begin{twocollist}
81 \twocolitem{{\bf wxColour(red=0, green=0, blue=0)}}{}
82 \twocolitem{{\bf wxNamedColour(name)}}{}
83 \end{twocollist}}
84 }
85
86
87
88 \membersection{wxColour::Blue}\label{wxcolourblue}
89
90 \constfunc{unsigned char}{Blue}{\void}
91
92 Returns the blue intensity.
93
94
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
104
105 \membersection{wxColour::Green}\label{wxcolourgreen}
106
107 \constfunc{unsigned char}{Green}{\void}
108
109 Returns the green intensity.
110
111
112 \membersection{wxColour::Ok}\label{wxcolourok}
113
114 \constfunc{bool}{Ok}{\void}
115
116 Returns \true if the colour object is valid (the colour has been initialised with RGB values).
117
118
119 \membersection{wxColour::Red}\label{wxcolourred}
120
121 \constfunc{unsigned char}{Red}{\void}
122
123 Returns the red intensity.
124
125
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
132
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
147
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
154
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
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
169 \wxheading{Include files}
170
171 <wx/cmndata.h>
172
173 \wxheading{See also}
174
175 \helpref{wxColour}{wxcolour}, \helpref{wxColourDialog}{wxcolourdialog}, \helpref{wxColourDialog overview}{wxcolourdialogoverview}
176
177 \latexignore{\rtfignore{\wxheading{Members}}}
178
179
180 \membersection{wxColourData::wxColourData}\label{wxcolourdatactor}
181
182 \func{}{wxColourData}{\void}
183
184 Constructor. Initializes the custom colours to {\tt wxNullColour},
185 the {\it data colour} setting
186 to black, and the {\it choose full} setting to true.
187
188
189 \membersection{wxColourData::\destruct{wxColourData}}\label{wxcolourdatadtor}
190
191 \func{}{\destruct{wxColourData}}{\void}
192
193 Destructor.
194
195
196 \membersection{wxColourData::GetChooseFull}\label{wxcolourdatagetchoosefull}
197
198 \constfunc{bool}{GetChooseFull}{\void}
199
200 Under Windows, determines whether the Windows colour dialog will display the full dialog
201 with custom colour selection controls. Under PalmOS, determines whether colour dialog
202 will display full rgb colour picker or only available palette indexer.
203 Has no meaning under other platforms.
204
205 The default value is true.
206
207
208 \membersection{wxColourData::GetColour}\label{wxcolourdatagetcolour}
209
210 \constfunc{wxColour\&}{GetColour}{\void}
211
212 Gets the current colour associated with the colour dialog.
213
214 The default colour is black.
215
216
217 \membersection{wxColourData::GetCustomColour}\label{wxcolourdatagetcustomcolour}
218
219 \constfunc{wxColour\&}{GetCustomColour}{\param{int}{ i}}
220
221 Gets the {\it i}th custom colour associated with the colour dialog. {\it i} should
222 be an integer between 0 and 15.
223
224 The default custom colours are invalid colours.
225
226
227 \membersection{wxColourData::SetChooseFull}\label{wxcolourdatasetchoosefull}
228
229 \func{void}{SetChooseFull}{\param{const bool }{flag}}
230
231 Under Windows, tells the Windows colour dialog to display the full dialog
232 with custom colour selection controls. Under other platforms, has no effect.
233
234 The default value is true.
235
236
237 \membersection{wxColourData::SetColour}\label{wxcolourdatasetcolour}
238
239 \func{void}{SetColour}{\param{const wxColour\&}{ colour}}
240
241 Sets the default colour for the colour dialog.
242
243 The default colour is black.
244
245
246 \membersection{wxColourData::SetCustomColour}\label{wxcolourdatasetcustomcolour}
247
248 \func{void}{SetCustomColour}{\param{int}{ i}, \param{const wxColour\&}{ colour}}
249
250 Sets the {\it i}th custom colour for the colour dialog. {\it i} should
251 be an integer between 0 and 15.
252
253 The default custom colours are invalid colours.
254
255
256 \membersection{wxColourData::operator $=$}\label{wxcolourdataassign}
257
258 \func{void}{operator $=$}{\param{const wxColourData\&}{ data}}
259
260 Assignment operator for the colour data.
261
262
263
264
265 \section{\class{wxColourDatabase}}\label{wxcolourdatabase}
266
267 wxWidgets maintains a database of standard RGB colours for a predefined
268 set of named colours (such as ``BLACK'', ``LIGHT GREY''). The
269 application may add to this set if desired by using
270 \helpref{AddColour}{wxcolourdatabaseaddcolour} and may use it to look up
271 colours by names using \helpref{Find}{wxcolourdatabasefind} or find the names
272 for the standard colour suing \helpref{FindName}{wxcolourdatabasefindname}.
273
274 There is one predefined instance of this class called
275 {\bf wxTheColourDatabase}.
276
277 \wxheading{Derived from}
278
279 None
280
281 \wxheading{Include files}
282
283 <wx/gdicmn.h>
284
285 \wxheading{Remarks}
286
287 The standard database contains at least the following colours:
288
289 AQUAMARINE, BLACK, BLUE, BLUE VIOLET, BROWN, CADET BLUE, CORAL,
290 CORNFLOWER BLUE, CYAN, DARK GREY, DARK GREEN, DARK OLIVE GREEN, DARK
291 ORCHID, DARK SLATE BLUE, DARK SLATE GREY DARK TURQUOISE, DIM GREY,
292 FIREBRICK, FOREST GREEN, GOLD, GOLDENROD, GREY, GREEN, GREEN YELLOW,
293 INDIAN RED, KHAKI, LIGHT BLUE, LIGHT GREY, LIGHT STEEL BLUE, LIME GREEN,
294 MAGENTA, MAROON, MEDIUM AQUAMARINE, MEDIUM BLUE, MEDIUM FOREST GREEN,
295 MEDIUM GOLDENROD, MEDIUM ORCHID, MEDIUM SEA GREEN, MEDIUM SLATE BLUE,
296 MEDIUM SPRING GREEN, MEDIUM TURQUOISE, MEDIUM VIOLET RED, MIDNIGHT BLUE,
297 NAVY, ORANGE, ORANGE RED, ORCHID, PALE GREEN, PINK, PLUM, PURPLE, RED,
298 SALMON, SEA GREEN, SIENNA, SKY BLUE, SLATE BLUE, SPRING GREEN, STEEL
299 BLUE, TAN, THISTLE, TURQUOISE, VIOLET, VIOLET RED, WHEAT, WHITE, YELLOW,
300 YELLOW GREEN.
301
302 \wxheading{See also}
303
304 \helpref{wxColour}{wxcolour}
305
306 \latexignore{\rtfignore{\wxheading{Members}}}
307
308
309 \membersection{wxColourDatabase::wxColourDatabase}\label{wxcolourdatabaseconstr}
310
311 \func{}{wxColourDatabase}{\void}
312
313 Constructs the colour database. It will be initialized at the first use.
314
315
316 \membersection{wxColourDatabase::AddColour}\label{wxcolourdatabaseaddcolour}
317
318 \func{void}{AddColour}{\param{const wxString\& }{colourName}, \param{const wxColour\&}{colour}}
319
320 \func{void}{AddColour}{\param{const wxString\& }{colourName}, \param{wxColour* }{colour}}
321
322 Adds a colour to the database. If a colour with the same name already exists,
323 it is replaced.
324
325 Please note that the overload taking a pointer is deprecated and will be
326 removed in the next wxWidgets version, please don't use it.
327
328
329 \membersection{wxColourDatabase::Find}\label{wxcolourdatabasefind}
330
331 \func{wxColour}{Find}{\param{const wxString\& }{colourName}}
332
333 Finds a colour given the name. Returns an invalid colour object (that is, such
334 that its \helpref{Ok()}{wxcolourok} method returns \false) if the colour wasn't
335 found in the database.
336
337
338 \membersection{wxColourDatabase::FindName}\label{wxcolourdatabasefindname}
339
340 \constfunc{wxString}{FindName}{\param{const wxColour\&}{ colour}}
341
342 Finds a colour name given the colour. Returns an empty string if the colour is
343 not found in the database.
344
345