1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxColour docs
5 %% Modified by: Francesco Montorsi
8 %% Copyright: (c) wxWidgets
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxColour
}}\label{wxcolour
}
14 A colour is an object representing a combination of Red, Green, and Blue (RGB) intensity values,
15 and is used to determine drawing colours. See the
16 entry for
\helpref{wxColourDatabase
}{wxcolourdatabase
} for how a pointer to a predefined,
17 named colour may be returned instead of creating a new colour.
19 Valid RGB values are in the range
0 to
255.
21 You can retrieve the current system colour settings with
\helpref{wxSystemSettings
}{wxsystemsettings
}.
23 \wxheading{Derived from
}
25 \helpref{wxObject
}{wxobject
}
27 \wxheading{Include files
}
31 \wxheading{Predefined objects
}
49 \helpref{wxColourDatabase
}{wxcolourdatabase
},
\helpref{wxPen
}{wxpen
},
\helpref{wxBrush
}{wxbrush
},
\rtfsp
50 \helpref{wxColourDialog
}{wxcolourdialog
},
\helpref{wxSystemSettings
}{wxsystemsettings
}
52 \latexignore{\rtfignore{\wxheading{Members
}}}
55 \membersection{wxColour::wxColour
}\label{wxcolourconstr
}
57 \func{}{wxColour
}{\void}
61 \func{}{wxColour
}{\param{unsigned char
}{ red
},
\param{unsigned char
}{ green
},
\param{unsigned char
}{ blue
}}
63 Constructs a colour from red, green and blue values.
65 \func{}{wxColour
}{\param{const wxString\&
}{colourNname
}}
67 Constructs a colour using the given string. See
\helpref{Set
}{wxcolourset3
} for more info.
69 \func{}{wxColour
}{\param{const wxColour\&
}{ colour
}}
73 \wxheading{Parameters
}
75 \docparam{red
}{The red value.
}
77 \docparam{green
}{The green value.
}
79 \docparam{blue
}{The blue value.
}
81 \docparam{colourName
}{The colour name.
}
83 \docparam{colour
}{The colour to copy.
}
87 \helpref{wxColourDatabase
}{wxcolourdatabase
}
89 \pythonnote{Constructors supported by wxPython are:
\par
90 \indented{2cm
}{\begin{twocollist
}
91 \twocolitem{{\bf wxColour(red=
0, green=
0, blue=
0)
}}{}
92 \twocolitem{{\bf wxNamedColour(name)
}}{}
98 \membersection{wxColour::Blue
}\label{wxcolourblue
}
100 \constfunc{unsigned char
}{Blue
}{\void}
102 Returns the blue intensity.
105 \membersection{wxColour::GetAsString
}\label{wxcolourgetasstring
}
107 \constfunc{wxString
}{GetAsString
}{\param{long
}{ flags
}}
109 Converts this colour to a
\helpref{wxString
}{wxstring
}
110 using the given
{\it flags
}.
112 The supported flags are
{\bf wxC2S_NAME
}, to obtain the colour
113 name (e.g. wxColour(
255,
0,
0) ->
\texttt{``red"
}),
{\bf wxC2S_CSS_SYNTAX
}, to obtain
114 the colour in the
\texttt{``rgb(r,g,b)"
} syntax
115 (e.g. wxColour(
255,
0,
0) ->
\texttt{``rgb(
255,
0,
0)"
}), and
{\bf wxC2S_HTML_SYNTAX
}, to obtain
116 the colour as
\texttt{``\#"
} followed by
6 hexadecimal digits
117 (e.g. wxColour(
255,
0,
0) ->
\texttt{``\#FF0000"
}).
119 This function never fails and always returns a non-empty string.
122 \membersection{wxColour::GetPixel
}\label{wxcolourgetpixel
}
124 \constfunc{long
}{GetPixel
}{\void}
126 Returns a pixel value which is platform-dependent. On Windows, a COLORREF is returned.
127 On X, an allocated pixel value is returned.
129 -
1 is returned if the pixel is invalid (on X, unallocated).
132 \membersection{wxColour::Green
}\label{wxcolourgreen
}
134 \constfunc{unsigned char
}{Green
}{\void}
136 Returns the green intensity.
139 \membersection{wxColour::Ok
}\label{wxcolourok
}
141 \constfunc{bool
}{Ok
}{\void}
143 Returns
\true if the colour object is valid (the colour has been initialised with RGB values).
146 \membersection{wxColour::Red
}\label{wxcolourred
}
148 \constfunc{unsigned char
}{Red
}{\void}
150 Returns the red intensity.
153 \membersection{wxColour::Set
}\label{wxcolourset
}
155 \func{void
}{Set
}{\param{unsigned char
}{ red
},
\param{unsigned char
}{ green
},
\param{unsigned char
}{ blue
}}
157 Sets the RGB intensity values.
160 \membersection{wxColour::Set
}\label{wxcolourset2
}
162 \func{void
}{Set
}{\param{unsigned long
}{ RGB
}}
164 Sets the RGB intensity values extracting them from the packed long.
167 \membersection{wxColour::Set
}\label{wxcolourset3
}
169 \func{bool
}{Set
}{\param{const wxString \&
}{ str
}}
171 Sets the colour using the given string.
172 Accepts colour names (those listed in
\helpref{wxTheColourDatabase
}{wxcolourdatabase
}), the CSS-like
\texttt{``RGB(r,g,b)"
} syntax (case insensitive) and the HTML-like syntax (i.e.
\texttt{``\#"
} followed by
6 hexadecimal digits for red, green, blue components).
174 Returns
\true if the conversion was successful,
\false otherwise.
177 \membersection{wxColour::operator $=$
}\label{wxcolourassign
}
179 \func{wxColour\&
}{operator $=$
}{\param{const wxColour\&
}{ colour
}}
181 Assignment operator, taking another colour object.
183 \func{wxColour\&
}{operator $=$
}{\param{const wxString\&
}{ colourName
}}
185 Assignment operator, using a colour name to be found in the colour database.
189 \helpref{wxColourDatabase
}{wxcolourdatabase
}
192 \membersection{wxColour::operator $==$
}\label{wxcolourequality
}
194 \func{bool
}{operator $==$
}{\param{const wxColour\&
}{ colour
}}
196 Tests the equality of two colours by comparing individual red, green blue colours.
199 \membersection{wxColour::operator $!=$
}\label{wxcolourinequality
}
201 \func{bool
}{operator $!=$
}{\param{const wxColour\&
}{ colour
}}
203 Tests the inequality of two colours by comparing individual red, green blue colours.
205 \section{\class{wxColourData
}}\label{wxcolourdata
}
207 This class holds a variety of information related to colour dialogs.
209 \wxheading{Derived from
}
211 \helpref{wxObject
}{wxobject
}
213 \wxheading{Include files
}
219 \helpref{wxColour
}{wxcolour
},
\helpref{wxColourDialog
}{wxcolourdialog
},
\helpref{wxColourDialog overview
}{wxcolourdialogoverview
}
221 \latexignore{\rtfignore{\wxheading{Members
}}}
224 \membersection{wxColourData::wxColourData
}\label{wxcolourdatactor
}
226 \func{}{wxColourData
}{\void}
228 Constructor. Initializes the custom colours to
{\tt wxNullColour
},
229 the
{\it data colour
} setting
230 to black, and the
{\it choose full
} setting to true.
233 \membersection{wxColourData::
\destruct{wxColourData
}}\label{wxcolourdatadtor
}
235 \func{}{\destruct{wxColourData
}}{\void}
240 \membersection{wxColourData::GetChooseFull
}\label{wxcolourdatagetchoosefull
}
242 \constfunc{bool
}{GetChooseFull
}{\void}
244 Under Windows, determines whether the Windows colour dialog will display the full dialog
245 with custom colour selection controls. Under PalmOS, determines whether colour dialog
246 will display full rgb colour picker or only available palette indexer.
247 Has no meaning under other platforms.
249 The default value is true.
252 \membersection{wxColourData::GetColour
}\label{wxcolourdatagetcolour
}
254 \constfunc{wxColour\&
}{GetColour
}{\void}
256 Gets the current colour associated with the colour dialog.
258 The default colour is black.
261 \membersection{wxColourData::GetCustomColour
}\label{wxcolourdatagetcustomcolour
}
263 \constfunc{wxColour\&
}{GetCustomColour
}{\param{int
}{ i
}}
265 Gets the
{\it i
}th custom colour associated with the colour dialog.
{\it i
} should
266 be an integer between
0 and
15.
268 The default custom colours are invalid colours.
271 \membersection{wxColourData::SetChooseFull
}\label{wxcolourdatasetchoosefull
}
273 \func{void
}{SetChooseFull
}{\param{const bool
}{flag
}}
275 Under Windows, tells the Windows colour dialog to display the full dialog
276 with custom colour selection controls. Under other platforms, has no effect.
278 The default value is true.
281 \membersection{wxColourData::SetColour
}\label{wxcolourdatasetcolour
}
283 \func{void
}{SetColour
}{\param{const wxColour\&
}{ colour
}}
285 Sets the default colour for the colour dialog.
287 The default colour is black.
290 \membersection{wxColourData::SetCustomColour
}\label{wxcolourdatasetcustomcolour
}
292 \func{void
}{SetCustomColour
}{\param{int
}{ i
},
\param{const wxColour\&
}{ colour
}}
294 Sets the
{\it i
}th custom colour for the colour dialog.
{\it i
} should
295 be an integer between
0 and
15.
297 The default custom colours are invalid colours.
300 \membersection{wxColourData::operator $=$
}\label{wxcolourdataassign
}
302 \func{void
}{operator $=$
}{\param{const wxColourData\&
}{ data
}}
304 Assignment operator for the colour data.
309 \section{\class{wxColourDatabase
}}\label{wxcolourdatabase
}
311 wxWidgets maintains a database of standard RGB colours for a predefined
312 set of named colours (such as ``BLACK'', ``LIGHT GREY''). The
313 application may add to this set if desired by using
314 \helpref{AddColour
}{wxcolourdatabaseaddcolour
} and may use it to look up
315 colours by names using
\helpref{Find
}{wxcolourdatabasefind
} or find the names
316 for the standard colour suing
\helpref{FindName
}{wxcolourdatabasefindname
}.
318 There is one predefined instance of this class called
319 {\bf wxTheColourDatabase
}.
321 \wxheading{Derived from
}
325 \wxheading{Include files
}
331 The standard database contains at least the following colours:
333 AQUAMARINE, BLACK, BLUE, BLUE VIOLET, BROWN, CADET BLUE, CORAL,
334 CORNFLOWER BLUE, CYAN, DARK GREY, DARK GREEN, DARK OLIVE GREEN, DARK
335 ORCHID, DARK SLATE BLUE, DARK SLATE GREY DARK TURQUOISE, DIM GREY,
336 FIREBRICK, FOREST GREEN, GOLD, GOLDENROD, GREY, GREEN, GREEN YELLOW,
337 INDIAN RED, KHAKI, LIGHT BLUE, LIGHT GREY, LIGHT STEEL BLUE, LIME GREEN,
338 MAGENTA, MAROON, MEDIUM AQUAMARINE, MEDIUM BLUE, MEDIUM FOREST GREEN,
339 MEDIUM GOLDENROD, MEDIUM ORCHID, MEDIUM SEA GREEN, MEDIUM SLATE BLUE,
340 MEDIUM SPRING GREEN, MEDIUM TURQUOISE, MEDIUM VIOLET RED, MIDNIGHT BLUE,
341 NAVY, ORANGE, ORANGE RED, ORCHID, PALE GREEN, PINK, PLUM, PURPLE, RED,
342 SALMON, SEA GREEN, SIENNA, SKY BLUE, SLATE BLUE, SPRING GREEN, STEEL
343 BLUE, TAN, THISTLE, TURQUOISE, VIOLET, VIOLET RED, WHEAT, WHITE, YELLOW,
348 \helpref{wxColour
}{wxcolour
}
350 \latexignore{\rtfignore{\wxheading{Members
}}}
353 \membersection{wxColourDatabase::wxColourDatabase
}\label{wxcolourdatabaseconstr
}
355 \func{}{wxColourDatabase
}{\void}
357 Constructs the colour database. It will be initialized at the first use.
360 \membersection{wxColourDatabase::AddColour
}\label{wxcolourdatabaseaddcolour
}
362 \func{void
}{AddColour
}{\param{const wxString\&
}{colourName
},
\param{const wxColour\&
}{colour
}}
364 \func{void
}{AddColour
}{\param{const wxString\&
}{colourName
},
\param{wxColour*
}{colour
}}
366 Adds a colour to the database. If a colour with the same name already exists,
369 Please note that the overload taking a pointer is deprecated and will be
370 removed in the next wxWidgets version, please don't use it.
373 \membersection{wxColourDatabase::Find
}\label{wxcolourdatabasefind
}
375 \func{wxColour
}{Find
}{\param{const wxString\&
}{colourName
}}
377 Finds a colour given the name. Returns an invalid colour object (that is, such
378 that its
\helpref{Ok()
}{wxcolourok
} method returns
\false) if the colour wasn't
379 found in the database.
382 \membersection{wxColourDatabase::FindName
}\label{wxcolourdatabasefindname
}
384 \constfunc{wxString
}{FindName
}{\param{const wxColour\&
}{ colour
}}
386 Finds a colour name given the colour. Returns an empty string if the colour is
387 not found in the database.