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