]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/colour.tex
wxTINY_CAPTION_XXX are obsolete
[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 \helpref{wxList}{wxlist}\\
250 \helpref{wxObject}{wxobject}
251
252 \wxheading{Include files}
253
254 <wx/gdicmn.h>
255
256 \wxheading{Remarks}
257
258 The colours in the standard database are as follows:
259
260 AQUAMARINE, BLACK, BLUE, BLUE VIOLET, BROWN, CADET BLUE, CORAL,
261 CORNFLOWER BLUE, CYAN, DARK GREY, DARK GREEN, DARK OLIVE GREEN, DARK
262 ORCHID, DARK SLATE BLUE, DARK SLATE GREY DARK TURQUOISE, DIM GREY,
263 FIREBRICK, FOREST GREEN, GOLD, GOLDENROD, GREY, GREEN, GREEN YELLOW,
264 INDIAN RED, KHAKI, LIGHT BLUE, LIGHT GREY, LIGHT STEEL BLUE, LIME GREEN,
265 MAGENTA, MAROON, MEDIUM AQUAMARINE, MEDIUM BLUE, MEDIUM FOREST GREEN,
266 MEDIUM GOLDENROD, MEDIUM ORCHID, MEDIUM SEA GREEN, MEDIUM SLATE BLUE,
267 MEDIUM SPRING GREEN, MEDIUM TURQUOISE, MEDIUM VIOLET RED, MIDNIGHT BLUE,
268 NAVY, ORANGE, ORANGE RED, ORCHID, PALE GREEN, PINK, PLUM, PURPLE, RED,
269 SALMON, SEA GREEN, SIENNA, SKY BLUE, SLATE BLUE, SPRING GREEN, STEEL
270 BLUE, TAN, THISTLE, TURQUOISE, VIOLET, VIOLET RED, WHEAT, WHITE, YELLOW,
271 YELLOW GREEN.
272
273 \wxheading{See also}
274
275 \helpref{wxColour}{wxcolour}
276
277 \latexignore{\rtfignore{\wxheading{Members}}}
278
279 \membersection{wxColourDatabase::wxColourDatabase}\label{wxcolourdatabaseconstr}
280
281 \func{}{wxColourDatabase}{\void}
282
283 Constructs the colour database.
284
285 \membersection{wxColourDatabase::FindColour}\label{wxcolourdatabasefindcolour}
286
287 \func{wxColour*}{FindColour}{\param{const wxString\& }{colourName}}
288
289 Finds a colour given the name. Returns NULL if not found.
290
291 \membersection{wxColourDatabase::FindName}\label{wxcolourdatabasefindname}
292
293 \constfunc{wxString}{FindName}{\param{const wxColour\&}{ colour}}
294
295 Finds a colour name given the colour. Returns NULL if not found.
296
297 \membersection{wxColourDatabase::Initialize}\label{wxcolourdatabaseinitialize}
298
299 \func{void}{Initialize}{\void}
300
301 Initializes the database with a number of stock colours. Called by wxWindows
302 on start-up.
303
304