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