1 \section{\class{wxColour
}}\label{wxcolour
}
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.
8 Valid RGB values are in the range
0 to
255.
10 You can retrieve the current system colour settings with
\helpref{wxSystemSettings
}{wxsystemsettings
}.
12 \wxheading{Derived from
}
14 \helpref{wxObject
}{wxobject
}
16 \wxheading{Include files
}
20 \wxheading{Predefined objects
}
38 \helpref{wxColourDatabase
}{wxcolourdatabase
},
\helpref{wxPen
}{wxpen
},
\helpref{wxBrush
}{wxbrush
},
\rtfsp
39 \helpref{wxColourDialog
}{wxcolourdialog
},
\helpref{wxSystemSettings
}{wxsystemsettings
}
41 \latexignore{\rtfignore{\wxheading{Members
}}}
44 \membersection{wxColour::wxColour
}\label{wxcolourconstr
}
46 \func{}{wxColour
}{\void}
50 \func{}{wxColour
}{\param{const unsigned char
}{ red
},
\param{const unsigned char
}{ green
},
\param{const unsigned char
}{ blue
}}
52 Constructs a colour from red, green and blue values.
54 \func{}{wxColour
}{\param{const wxString\&
}{colourNname
}}
56 Constructs a colour object using a colour name
57 listed in
{\bf wxTheColourDatabase
}.
59 \func{}{wxColour
}{\param{const wxColour\&
}{ colour
}}
63 \wxheading{Parameters
}
65 \docparam{red
}{The red value.
}
67 \docparam{green
}{The green value.
}
69 \docparam{blue
}{The blue value.
}
71 \docparam{colourName
}{The colour name.
}
73 \docparam{colour
}{The colour to copy.
}
77 \helpref{wxColourDatabase
}{wxcolourdatabase
}
79 \pythonnote{Constructors supported by wxPython are:
\par
80 \indented{2cm
}{\begin{twocollist
}
81 \twocolitem{{\bf wxColour(red=
0, green=
0, blue=
0)
}}{}
82 \twocolitem{{\bf wxNamedColour(name)
}}{}
88 \membersection{wxColour::Blue
}\label{wxcolourblue
}
90 \constfunc{unsigned char
}{Blue
}{\void}
92 Returns the blue intensity.
95 \membersection{wxColour::GetPixel
}\label{wxcolourgetpixel
}
97 \constfunc{long
}{GetPixel
}{\void}
99 Returns a pixel value which is platform-dependent. On Windows, a COLORREF is returned.
100 On X, an allocated pixel value is returned.
102 -
1 is returned if the pixel is invalid (on X, unallocated).
105 \membersection{wxColour::Green
}\label{wxcolourgreen
}
107 \constfunc{unsigned char
}{Green
}{\void}
109 Returns the green intensity.
112 \membersection{wxColour::Ok
}\label{wxcolourok
}
114 \constfunc{bool
}{Ok
}{\void}
116 Returns
\true if the colour object is valid (the colour has been initialised with RGB values).
119 \membersection{wxColour::Red
}\label{wxcolourred
}
121 \constfunc{unsigned char
}{Red
}{\void}
123 Returns the red intensity.
126 \membersection{wxColour::Set
}\label{wxcolourset
}
128 \func{void
}{Set
}{\param{const unsigned char
}{ red
},
\param{const unsigned char
}{ green
},
\param{const unsigned char
}{ blue
}}
130 Sets the RGB intensity values.
133 \membersection{wxColour::operator $=$
}\label{wxcolourassign
}
135 \func{wxColour\&
}{operator $=$
}{\param{const wxColour\&
}{ colour
}}
137 Assignment operator, taking another colour object.
139 \func{wxColour\&
}{operator $=$
}{\param{const wxString\&
}{ colourName
}}
141 Assignment operator, using a colour name to be found in the colour database.
145 \helpref{wxColourDatabase
}{wxcolourdatabase
}
148 \membersection{wxColour::operator $==$
}\label{wxcolourequality
}
150 \func{bool
}{operator $==$
}{\param{const wxColour\&
}{ colour
}}
152 Tests the equality of two colours by comparing individual red, green blue colours.
155 \membersection{wxColour::operator $!=$
}\label{wxcolourinequality
}
157 \func{bool
}{operator $!=$
}{\param{const wxColour\&
}{ colour
}}
159 Tests the inequality of two colours by comparing individual red, green blue colours.
161 \section{\class{wxColourData
}}\label{wxcolourdata
}
163 This class holds a variety of information related to colour dialogs.
165 \wxheading{Derived from
}
167 \helpref{wxObject
}{wxobject
}
169 \wxheading{Include files
}
175 \helpref{wxColour
}{wxcolour
},
\helpref{wxColourDialog
}{wxcolourdialog
},
\helpref{wxColourDialog overview
}{wxcolourdialogoverview
}
177 \latexignore{\rtfignore{\wxheading{Members
}}}
180 \membersection{wxColourData::wxColourData
}\label{wxcolourdataconstr
}
182 \func{}{wxColourData
}{\void}
184 Constructor. Initializes the custom colours to
{\tt wxNullColour
},
185 the
{\it data colour
} setting
186 to black, and the
{\it choose full
} setting to true.
189 \membersection{wxColourData::
\destruct{wxColourData
}}
191 \func{}{\destruct{wxColourData
}}{\void}
196 \membersection{wxColourData::GetChooseFull
}\label{wxcolourdatagetchoosefull
}
198 \constfunc{bool
}{GetChooseFull
}{\void}
200 Under Windows, determines whether the Windows colour dialog will display the full dialog
201 with custom colour selection controls. Has no meaning under other platforms.
203 The default value is true.
206 \membersection{wxColourData::GetColour
}\label{wxcolourdatagetcolour
}
208 \constfunc{wxColour\&
}{GetColour
}{\void}
210 Gets the current colour associated with the colour dialog.
212 The default colour is black.
215 \membersection{wxColourData::GetCustomColour
}\label{wxcolourdatagetcustomcolour
}
217 \constfunc{wxColour\&
}{GetCustomColour
}{\param{int
}{ i
}}
219 Gets the
{\it i
}th custom colour associated with the colour dialog.
{\it i
} should
220 be an integer between
0 and
15.
222 The default custom colours are invalid colours.
225 \membersection{wxColourData::SetChooseFull
}\label{wxcolourdatasetchoosefull
}
227 \func{void
}{SetChooseFull
}{\param{const bool
}{flag
}}
229 Under Windows, tells the Windows colour dialog to display the full dialog
230 with custom colour selection controls. Under other platforms, has no effect.
232 The default value is true.
235 \membersection{wxColourData::SetColour
}\label{wxcolourdatasetcolour
}
237 \func{void
}{SetColour
}{\param{const wxColour\&
}{ colour
}}
239 Sets the default colour for the colour dialog.
241 The default colour is black.
244 \membersection{wxColourData::SetCustomColour
}\label{wxcolourdatasetcustomcolour
}
246 \func{void
}{SetCustomColour
}{\param{int
}{ i
},
\param{const wxColour\&
}{ colour
}}
248 Sets the
{\it i
}th custom colour for the colour dialog.
{\it i
} should
249 be an integer between
0 and
15.
251 The default custom colours are invalid colours.
254 \membersection{wxColourData::operator $=$
}\label{wxcolourdataassign
}
256 \func{void
}{operator $=$
}{\param{const wxColourData\&
}{ data
}}
258 Assignment operator for the colour data.
263 \section{\class{wxColourDatabase
}}\label{wxcolourdatabase
}
265 wxWidgets maintains a database of standard RGB colours for a predefined
266 set of named colours (such as ``BLACK'', ``LIGHT GREY''). The
267 application may add to this set if desired by using
268 \helpref{AddColour
}{wxcolourdatabaseaddcolour
} and may use it to look up
269 colours by names using
\helpref{Find
}{wxcolourdatabasefind
} or find the names
270 for the standard colour suing
\helpref{FindName
}{wxcolourdatabasefindname
}.
272 There is one predefined instance of this class called
273 {\bf wxTheColourDatabase
}.
275 \wxheading{Derived from
}
279 \wxheading{Include files
}
285 The standard database contains at least the following colours:
287 AQUAMARINE, BLACK, BLUE, BLUE VIOLET, BROWN, CADET BLUE, CORAL,
288 CORNFLOWER BLUE, CYAN, DARK GREY, DARK GREEN, DARK OLIVE GREEN, DARK
289 ORCHID, DARK SLATE BLUE, DARK SLATE GREY DARK TURQUOISE, DIM GREY,
290 FIREBRICK, FOREST GREEN, GOLD, GOLDENROD, GREY, GREEN, GREEN YELLOW,
291 INDIAN RED, KHAKI, LIGHT BLUE, LIGHT GREY, LIGHT STEEL BLUE, LIME GREEN,
292 MAGENTA, MAROON, MEDIUM AQUAMARINE, MEDIUM BLUE, MEDIUM FOREST GREEN,
293 MEDIUM GOLDENROD, MEDIUM ORCHID, MEDIUM SEA GREEN, MEDIUM SLATE BLUE,
294 MEDIUM SPRING GREEN, MEDIUM TURQUOISE, MEDIUM VIOLET RED, MIDNIGHT BLUE,
295 NAVY, ORANGE, ORANGE RED, ORCHID, PALE GREEN, PINK, PLUM, PURPLE, RED,
296 SALMON, SEA GREEN, SIENNA, SKY BLUE, SLATE BLUE, SPRING GREEN, STEEL
297 BLUE, TAN, THISTLE, TURQUOISE, VIOLET, VIOLET RED, WHEAT, WHITE, YELLOW,
302 \helpref{wxColour
}{wxcolour
}
304 \latexignore{\rtfignore{\wxheading{Members
}}}
307 \membersection{wxColourDatabase::wxColourDatabase
}\label{wxcolourdatabaseconstr
}
309 \func{}{wxColourDatabase
}{\void}
311 Constructs the colour database. It will be initialized at the first use.
314 \membersection{wxColourDatabase::AddColour
}\label{wxcolourdatabaseaddcolour
}
316 \func{void
}{AddColour
}{\param{const wxString\&
}{colourName
},
\param{const wxColour\&
}{colour
}}
318 \func{void
}{AddColour
}{\param{const wxString\&
}{colourName
},
\param{wxColour*
}{colour
}}
320 Adds a colour to the database. If a colour with the same name already exists,
323 Please note that the overload taking a pointer is deprecated and will be
324 removed in the next wxWidgets version, please don't use it.
327 \membersection{wxColourDatabase::Find
}\label{wxcolourdatabasefind
}
329 \func{wxColour
}{FindColour
}{\param{const wxString\&
}{colourName
}}
331 Finds a colour given the name. Returns an invalid colour object (that is, such
332 that its
\helpref{Ok()
}{wxcolourok
} method returns
\false) if the colour wasn't
333 found in the database.
336 \membersection{wxColourDatabase::FindColour
}\label{wxcolourdatabasefindcolour
}
338 \func{wxColour*
}{FindColour
}{\param{const wxString\&
}{colourName
}}
340 Finds a colour given the name. Returns
{\tt NULL
} if not found or a pointer which
341 must be deleted by the caller otherwise.
343 Please note that this method is deprecated and will be removed in the next
344 wxWidgets version, please use
\helpref{Find
}{wxcolourdatabasefind
} instead of
348 \membersection{wxColourDatabase::FindName
}\label{wxcolourdatabasefindname
}
350 \constfunc{wxString
}{FindName
}{\param{const wxColour\&
}{ colour
}}
352 Finds a colour name given the colour. Returns an empty string if the colour is
353 not found in the database.