]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/colour.tex
Small tweaks for WinCE compatibility
[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 \membersection{wxColour::wxColour}\label{wxcolourconstr}
44
45 \func{}{wxColour}{\void}
46
47 Default constructor.
48
49 \func{}{wxColour}{\param{const unsigned char}{ red}, \param{const unsigned char}{ green}, \param{const unsigned char}{ blue}}
50
51 Constructs a colour from red, green and blue values.
52
53 \func{}{wxColour}{\param{const wxString\& }{colourNname}}
54
55 Constructs a colour object using a colour name
56 listed in {\bf wxTheColourDatabase}.
57
58 \func{}{wxColour}{\param{const wxColour\&}{ colour}}
59
60 Copy constructor.
61
62 \wxheading{Parameters}
63
64 \docparam{red}{The red value.}
65
66 \docparam{green}{The green value.}
67
68 \docparam{blue}{The blue value.}
69
70 \docparam{colourName}{The colour name.}
71
72 \docparam{colour}{The colour to copy.}
73
74 \wxheading{See also}
75
76 \helpref{wxColourDatabase}{wxcolourdatabase}
77
78 \pythonnote{Constructors supported by wxPython are:\par
79 \indented{2cm}{\begin{twocollist}
80 \twocolitem{{\bf wxColour(red=0, green=0, blue=0)}}{}
81 \twocolitem{{\bf wxNamedColour(name)}}{}
82 \end{twocollist}}
83 }
84
85
86 \membersection{wxColour::Blue}\label{wxcolourblue}
87
88 \constfunc{unsigned char}{Blue}{\void}
89
90 Returns the blue intensity.
91
92 \membersection{wxColour::GetPixel}\label{wxcolourgetpixel}
93
94 \constfunc{long}{GetPixel}{\void}
95
96 Returns a pixel value which is platform-dependent. On Windows, a COLORREF is returned.
97 On X, an allocated pixel value is returned.
98
99 -1 is returned if the pixel is invalid (on X, unallocated).
100
101 \membersection{wxColour::Green}\label{wxcolourgreen}
102
103 \constfunc{unsigned char}{Green}{\void}
104
105 Returns the green intensity.
106
107 \membersection{wxColour::Ok}\label{wxcolourok}
108
109 \constfunc{bool}{Ok}{\void}
110
111 Returns true if the colour object is valid (the colour has been initialised with RGB values).
112
113 \membersection{wxColour::Red}\label{wxcolourred}
114
115 \constfunc{unsigned char}{Red}{\void}
116
117 Returns the red intensity.
118
119 \membersection{wxColour::Set}\label{wxcolourset}
120
121 \func{void}{Set}{\param{const unsigned char}{ red}, \param{const unsigned char}{ green}, \param{const unsigned char}{ blue}}
122
123 Sets the RGB intensity values.
124
125 \membersection{wxColour::operator $=$}\label{wxcolourassign}
126
127 \func{wxColour\&}{operator $=$}{\param{const wxColour\&}{ colour}}
128
129 Assignment operator, taking another colour object.
130
131 \func{wxColour\&}{operator $=$}{\param{const wxString\&}{ colourName}}
132
133 Assignment operator, using a colour name to be found in the colour database.
134
135 \wxheading{See also}
136
137 \helpref{wxColourDatabase}{wxcolourdatabase}
138
139 \membersection{wxColour::operator $==$}\label{wxcolourequality}
140
141 \func{bool}{operator $==$}{\param{const wxColour\&}{ colour}}
142
143 Tests the equality of two colours by comparing individual red, green blue colours.
144
145 \membersection{wxColour::operator $!=$}\label{wxcolourinequality}
146
147 \func{bool}{operator $!=$}{\param{const wxColour\&}{ colour}}
148
149 Tests the inequality of two colours by comparing individual red, green blue colours.
150
151 \section{\class{wxColourData}}\label{wxcolourdata}
152
153 This class holds a variety of information related to colour dialogs.
154
155 \wxheading{Derived from}
156
157 \helpref{wxObject}{wxobject}
158
159 \wxheading{Include files}
160
161 <wx/cmndata.h>
162
163 \wxheading{See also}
164
165 \helpref{wxColour}{wxcolour}, \helpref{wxColourDialog}{wxcolourdialog}, \helpref{wxColourDialog overview}{wxcolourdialogoverview}
166
167 \latexignore{\rtfignore{\wxheading{Members}}}
168
169 \membersection{wxColourData::wxColourData}\label{wxcolourdataconstr}
170
171 \func{}{wxColourData}{\void}
172
173 Constructor. Initializes the custom colours to white, the {\it data colour} setting
174 to black, and the {\it choose full} setting to true.
175
176 \membersection{wxColourData::\destruct{wxColourData}}
177
178 \func{}{\destruct{wxColourData}}{\void}
179
180 Destructor.
181
182 \membersection{wxColourData::GetChooseFull}\label{wxcolourdatagetchoosefull}
183
184 \constfunc{bool}{GetChooseFull}{\void}
185
186 Under Windows, determines whether the Windows colour dialog will display the full dialog
187 with custom colour selection controls. Has no meaning under other platforms.
188
189 The default value is true.
190
191 \membersection{wxColourData::GetColour}\label{wxcolourdatagetcolour}
192
193 \constfunc{wxColour\&}{GetColour}{\void}
194
195 Gets the current colour associated with the colour dialog.
196
197 The default colour is black.
198
199 \membersection{wxColourData::GetCustomColour}\label{wxcolourdatagetcustomcolour}
200
201 \constfunc{wxColour\&}{GetCustomColour}{\param{int}{ i}}
202
203 Gets the {\it i}th custom colour associated with the colour dialog. {\it i} should
204 be an integer between 0 and 15.
205
206 The default custom colours are all white.
207
208 \membersection{wxColourData::SetChooseFull}\label{wxcolourdatasetchoosefull}
209
210 \func{void}{SetChooseFull}{\param{const bool }{flag}}
211
212 Under Windows, tells the Windows colour dialog to display the full dialog
213 with custom colour selection controls. Under other platforms, has no effect.
214
215 The default value is true.
216
217 \membersection{wxColourData::SetColour}\label{wxcolourdatasetcolour}
218
219 \func{void}{SetColour}{\param{const wxColour\&}{ colour}}
220
221 Sets the default colour for the colour dialog.
222
223 The default colour is black.
224
225 \membersection{wxColourData::SetCustomColour}\label{wxcolourdatasetcustomcolour}
226
227 \func{void}{SetCustomColour}{\param{int}{ i}, \param{const wxColour\&}{ colour}}
228
229 Sets the {\it i}th custom colour for the colour dialog. {\it i} should
230 be an integer between 0 and 15.
231
232 The default custom colours are all white.
233
234 \membersection{wxColourData::operator $=$}\label{wxcolourdataassign}
235
236 \func{void}{operator $=$}{\param{const wxColourData\&}{ data}}
237
238 Assignment operator for the colour data.
239
240 \section{\class{wxColourDatabase}}\label{wxcolourdatabase}
241
242 wxWindows maintains a database of standard RGB colours for a predefined
243 set of named colours (such as ``BLACK'', ``LIGHT GREY''). The
244 application may add to this set if desired by using {\it Append}. There
245 is only one instance of this class: {\bf wxTheColourDatabase}.
246
247 \wxheading{Derived from}
248
249 None
250
251 \wxheading{Include files}
252
253 <wx/gdicmn.h>
254
255 \wxheading{Remarks}
256
257 The colours in the standard database are as follows:
258
259 AQUAMARINE, BLACK, BLUE, BLUE VIOLET, BROWN, CADET BLUE, CORAL,
260 CORNFLOWER BLUE, CYAN, DARK GREY, DARK GREEN, DARK OLIVE GREEN, DARK
261 ORCHID, DARK SLATE BLUE, DARK SLATE GREY DARK TURQUOISE, DIM GREY,
262 FIREBRICK, FOREST GREEN, GOLD, GOLDENROD, GREY, GREEN, GREEN YELLOW,
263 INDIAN RED, KHAKI, LIGHT BLUE, LIGHT GREY, LIGHT STEEL BLUE, LIME GREEN,
264 MAGENTA, MAROON, MEDIUM AQUAMARINE, MEDIUM BLUE, MEDIUM FOREST GREEN,
265 MEDIUM GOLDENROD, MEDIUM ORCHID, MEDIUM SEA GREEN, MEDIUM SLATE BLUE,
266 MEDIUM SPRING GREEN, MEDIUM TURQUOISE, MEDIUM VIOLET RED, MIDNIGHT BLUE,
267 NAVY, ORANGE, ORANGE RED, ORCHID, PALE GREEN, PINK, PLUM, PURPLE, RED,
268 SALMON, SEA GREEN, SIENNA, SKY BLUE, SLATE BLUE, SPRING GREEN, STEEL
269 BLUE, TAN, THISTLE, TURQUOISE, VIOLET, VIOLET RED, WHEAT, WHITE, YELLOW,
270 YELLOW GREEN.
271
272 \wxheading{See also}
273
274 \helpref{wxColour}{wxcolour}
275
276 \latexignore{\rtfignore{\wxheading{Members}}}
277
278 \membersection{wxColourDatabase::wxColourDatabase}\label{wxcolourdatabaseconstr}
279
280 \func{}{wxColourDatabase}{\void}
281
282 Constructs the colour database.
283
284 \membersection{wxColourDatabase::AddColour}\label{wxcolourdatabaseaddcolour}
285
286 \func{void}{AddColour}{\param{const wxString\& }{colourName}, \param{wxColour* }{colour}}
287
288 Adds a colour to the database. If a colour with the same name already exists,
289 it is replaced.
290
291 \membersection{wxColourDatabase::FindColour}\label{wxcolourdatabasefindcolour}
292
293 \func{wxColour*}{FindColour}{\param{const wxString\& }{colourName}}
294
295 Finds a colour given the name. Returns NULL if not found.
296
297 \membersection{wxColourDatabase::FindName}\label{wxcolourdatabasefindname}
298
299 \constfunc{wxString}{FindName}{\param{const wxColour\&}{ colour}}
300
301 Finds a colour name given the colour. Returns NULL if not found.
302
303 \membersection{wxColourDatabase::Initialize}\label{wxcolourdatabaseinitialize}
304
305 \func{void}{Initialize}{\void}
306
307 Initializes the database with a number of stock colours. Called by wxWindows
308 on start-up.
309
310