]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/colour.tex
Fixed to work with the new wxMacControl system.
[wxWidgets.git] / docs / latex / wx / colour.tex
CommitLineData
a660d684
KB
1\section{\class{wxColour}}\label{wxcolour}
2
3A colour is an object representing a combination of Red, Green, and Blue (RGB) intensity values,
4and is used to determine drawing colours. See the
5entry for \helpref{wxColourDatabase}{wxcolourdatabase} for how a pointer to a predefined,
6named colour may be returned instead of creating a new colour.
7
8Valid RGB values are in the range 0 to 255.
9
8161ba08
JS
10You 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
22Objects:
23
24{\bf wxNullColour}
25
26Pointers:
27
28{\bf wxBLACK\\
29wxWHITE\\
30wxRED\\
31wxBLUE\\
32wxGREEN\\
33wxCYAN\\
34wxLIGHT\_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
48Default constructor.
49
50\func{}{wxColour}{\param{const unsigned char}{ red}, \param{const unsigned char}{ green}, \param{const unsigned char}{ blue}}
51
52Constructs a colour from red, green and blue values.
53
54\func{}{wxColour}{\param{const wxString\& }{colourNname}}
55
56Constructs a colour object using a colour name
57listed in {\bf wxTheColourDatabase}.
58
1e6d9499
JS
59\func{}{wxColour}{\param{const wxColour\&}{ colour}}
60
61Copy 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
92Returns the blue intensity.
93
c50f92d0 94
a660d684
KB
95\membersection{wxColour::GetPixel}\label{wxcolourgetpixel}
96
97\constfunc{long}{GetPixel}{\void}
98
99Returns a pixel value which is platform-dependent. On Windows, a COLORREF is returned.
100On 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
109Returns the green intensity.
110
c50f92d0 111
a660d684
KB
112\membersection{wxColour::Ok}\label{wxcolourok}
113
114\constfunc{bool}{Ok}{\void}
115
c50f92d0
VZ
116Returns \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
123Returns 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
130Sets 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
137Assignment operator, taking another colour object.
138
139\func{wxColour\&}{operator $=$}{\param{const wxString\&}{ colourName}}
140
141Assignment 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
152Tests 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
159Tests the inequality of two colours by comparing individual red, green blue colours.
160
a660d684
KB
161\section{\class{wxColourData}}\label{wxcolourdata}
162
163This 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
393c836c
VS
184Constructor. Initializes the custom colours to {\tt wxNullColour},
185the {\it data colour} setting
cc81d32f 186to black, and the {\it choose full} setting to true.
a660d684 187
c50f92d0 188
a660d684
KB
189\membersection{wxColourData::\destruct{wxColourData}}
190
191\func{}{\destruct{wxColourData}}{\void}
192
193Destructor.
194
c50f92d0 195
a660d684
KB
196\membersection{wxColourData::GetChooseFull}\label{wxcolourdatagetchoosefull}
197
198\constfunc{bool}{GetChooseFull}{\void}
199
200Under Windows, determines whether the Windows colour dialog will display the full dialog
201with custom colour selection controls. Has no meaning under other platforms.
202
cc81d32f 203The default value is true.
a660d684 204
c50f92d0 205
a660d684
KB
206\membersection{wxColourData::GetColour}\label{wxcolourdatagetcolour}
207
208\constfunc{wxColour\&}{GetColour}{\void}
209
210Gets the current colour associated with the colour dialog.
211
212The default colour is black.
213
c50f92d0 214
a660d684
KB
215\membersection{wxColourData::GetCustomColour}\label{wxcolourdatagetcustomcolour}
216
eaaa6a06 217\constfunc{wxColour\&}{GetCustomColour}{\param{int}{ i}}
a660d684
KB
218
219Gets the {\it i}th custom colour associated with the colour dialog. {\it i} should
220be an integer between 0 and 15.
221
393c836c 222The default custom colours are invalid colours.
a660d684 223
c50f92d0 224
a660d684
KB
225\membersection{wxColourData::SetChooseFull}\label{wxcolourdatasetchoosefull}
226
227\func{void}{SetChooseFull}{\param{const bool }{flag}}
228
229Under Windows, tells the Windows colour dialog to display the full dialog
230with custom colour selection controls. Under other platforms, has no effect.
231
cc81d32f 232The default value is true.
a660d684 233
c50f92d0 234
a660d684
KB
235\membersection{wxColourData::SetColour}\label{wxcolourdatasetcolour}
236
237\func{void}{SetColour}{\param{const wxColour\&}{ colour}}
238
239Sets the default colour for the colour dialog.
240
241The default colour is black.
242
c50f92d0 243
a660d684
KB
244\membersection{wxColourData::SetCustomColour}\label{wxcolourdatasetcustomcolour}
245
f6bcfd97 246\func{void}{SetCustomColour}{\param{int}{ i}, \param{const wxColour\&}{ colour}}
a660d684
KB
247
248Sets the {\it i}th custom colour for the colour dialog. {\it i} should
249be an integer between 0 and 15.
250
393c836c 251The default custom colours are invalid colours.
a660d684 252
c50f92d0 253
a660d684
KB
254\membersection{wxColourData::operator $=$}\label{wxcolourdataassign}
255
256\func{void}{operator $=$}{\param{const wxColourData\&}{ data}}
257
2edb0bde 258Assignment operator for the colour data.
a660d684 259
c50f92d0
VZ
260
261
262
a660d684
KB
263\section{\class{wxColourDatabase}}\label{wxcolourdatabase}
264
fc2171bd 265wxWidgets maintains a database of standard RGB colours for a predefined
a660d684 266set of named colours (such as ``BLACK'', ``LIGHT GREY''). The
c50f92d0
VZ
267application may add to this set if desired by using
268\helpref{AddColour}{wxcolourdatabaseaddcolour} and may use it to look up
269colours by names using \helpref{Find}{wxcolourdatabasefind} or find the names
270for the standard colour suing \helpref{FindName}{wxcolourdatabasefindname}.
271
272There is one predefined instance of this class called
273{\bf wxTheColourDatabase}.
a660d684
KB
274
275\wxheading{Derived from}
276
8f520a56 277None
a660d684 278
954b8ae6
JS
279\wxheading{Include files}
280
281<wx/gdicmn.h>
282
a660d684
KB
283\wxheading{Remarks}
284
c50f92d0 285The standard database contains at least the following colours:
a660d684
KB
286
287AQUAMARINE, BLACK, BLUE, BLUE VIOLET, BROWN, CADET BLUE, CORAL,
288CORNFLOWER BLUE, CYAN, DARK GREY, DARK GREEN, DARK OLIVE GREEN, DARK
289ORCHID, DARK SLATE BLUE, DARK SLATE GREY DARK TURQUOISE, DIM GREY,
290FIREBRICK, FOREST GREEN, GOLD, GOLDENROD, GREY, GREEN, GREEN YELLOW,
291INDIAN RED, KHAKI, LIGHT BLUE, LIGHT GREY, LIGHT STEEL BLUE, LIME GREEN,
292MAGENTA, MAROON, MEDIUM AQUAMARINE, MEDIUM BLUE, MEDIUM FOREST GREEN,
293MEDIUM GOLDENROD, MEDIUM ORCHID, MEDIUM SEA GREEN, MEDIUM SLATE BLUE,
294MEDIUM SPRING GREEN, MEDIUM TURQUOISE, MEDIUM VIOLET RED, MIDNIGHT BLUE,
295NAVY, ORANGE, ORANGE RED, ORCHID, PALE GREEN, PINK, PLUM, PURPLE, RED,
296SALMON, SEA GREEN, SIENNA, SKY BLUE, SLATE BLUE, SPRING GREEN, STEEL
297BLUE, TAN, THISTLE, TURQUOISE, VIOLET, VIOLET RED, WHEAT, WHITE, YELLOW,
298YELLOW GREEN.
299
300\wxheading{See also}
301
302\helpref{wxColour}{wxcolour}
303
304\latexignore{\rtfignore{\wxheading{Members}}}
305
c50f92d0 306
a660d684
KB
307\membersection{wxColourDatabase::wxColourDatabase}\label{wxcolourdatabaseconstr}
308
309\func{}{wxColourDatabase}{\void}
310
c50f92d0
VZ
311Constructs the colour database. It will be initialized at the first use.
312
a660d684 313
8f520a56
MB
314\membersection{wxColourDatabase::AddColour}\label{wxcolourdatabaseaddcolour}
315
c50f92d0
VZ
316\func{void}{AddColour}{\param{const wxString\& }{colourName}, \param{const wxColour\&}{colour}}
317
8f520a56
MB
318\func{void}{AddColour}{\param{const wxString\& }{colourName}, \param{wxColour* }{colour}}
319
320Adds a colour to the database. If a colour with the same name already exists,
321it is replaced.
322
c50f92d0 323Please note that the overload taking a pointer is deprecated and will be
fc2171bd 324removed in the next wxWidgets version, please don't use it.
c50f92d0
VZ
325
326
327\membersection{wxColourDatabase::Find}\label{wxcolourdatabasefind}
328
329\func{wxColour}{FindColour}{\param{const wxString\& }{colourName}}
330
331Finds a colour given the name. Returns an invalid colour object (that is, such
332that its \helpref{Ok()}{wxcolourok} method returns \false) if the colour wasn't
333found in the database.
334
335
a660d684
KB
336\membersection{wxColourDatabase::FindColour}\label{wxcolourdatabasefindcolour}
337
338\func{wxColour*}{FindColour}{\param{const wxString\& }{colourName}}
339
75173186 340Finds a colour given the name. Returns {\tt NULL} if not found or a pointer which
c50f92d0 341must be deleted by the caller otherwise.
a660d684 342
c50f92d0 343Please note that this method is deprecated and will be removed in the next
fc2171bd 344wxWidgets version, please use \helpref{Find}{wxcolourdatabasefind} instead of
c50f92d0 345it.
a660d684 346
a660d684 347
c50f92d0 348\membersection{wxColourDatabase::FindName}\label{wxcolourdatabasefindname}
a660d684 349
c50f92d0 350\constfunc{wxString}{FindName}{\param{const wxColour\&}{ colour}}
a660d684 351
c50f92d0
VZ
352Finds a colour name given the colour. Returns an empty string if the colour is
353not found in the database.
a660d684
KB
354
355