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