You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
309 lines
20 KiB
309 lines
20 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qpalette.cpp:512 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>TQPalette Class</title>
|
|
<style type="text/css"><!--
|
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
|
a:link { color: #004faf; text-decoration: none }
|
|
a:visited { color: #672967; text-decoration: none }
|
|
body { background: #ffffff; color: black; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tr bgcolor="#E5E5E5">
|
|
<td valign=center>
|
|
<a href="index.html">
|
|
<font color="#004faf">Home</font></a>
|
|
| <a href="classes.html">
|
|
<font color="#004faf">All Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped Classes</font></a>
|
|
| <a href="functions.html">
|
|
<font color="#004faf">Functions</font></a>
|
|
</td>
|
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQPalette Class Reference</h1>
|
|
|
|
<p>The TQPalette class contains color groups for each widget state.
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="qpalette-h.html">ntqpalette.h</a>></tt>
|
|
<p><a href="qpalette-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn><a href="#TQPalette"><b>TQPalette</b></a> ()</li>
|
|
<li class=fn>TQPalette ( const TQColor & button ) <em>(obsolete)</em></li>
|
|
<li class=fn><a href="#TQPalette-3"><b>TQPalette</b></a> ( const TQColor & button, const TQColor & background )</li>
|
|
<li class=fn><a href="#TQPalette-4"><b>TQPalette</b></a> ( const TQColorGroup & active, const TQColorGroup & disabled, const TQColorGroup & inactive )</li>
|
|
<li class=fn><a href="#TQPalette-5"><b>TQPalette</b></a> ( const TQPalette & p )</li>
|
|
<li class=fn><a href="#~TQPalette"><b>~TQPalette</b></a> ()</li>
|
|
<li class=fn>TQPalette & <a href="#operator-eq"><b>operator=</b></a> ( const TQPalette & p )</li>
|
|
<li class=fn>enum <a href="#ColorGroup-enum"><b>ColorGroup</b></a> { Disabled, Active, Inactive, NColorGroups, Normal = Active }</li>
|
|
<li class=fn>const TQColor & <a href="#color"><b>color</b></a> ( ColorGroup gr, TQColorGroup::ColorRole r ) const</li>
|
|
<li class=fn>const TQBrush & <a href="#brush"><b>brush</b></a> ( ColorGroup gr, TQColorGroup::ColorRole r ) const</li>
|
|
<li class=fn>void <a href="#setColor"><b>setColor</b></a> ( ColorGroup gr, TQColorGroup::ColorRole r, const TQColor & c )</li>
|
|
<li class=fn>void <a href="#setBrush"><b>setBrush</b></a> ( ColorGroup gr, TQColorGroup::ColorRole r, const TQBrush & b )</li>
|
|
<li class=fn>void <a href="#setColor-2"><b>setColor</b></a> ( TQColorGroup::ColorRole r, const TQColor & c )</li>
|
|
<li class=fn>void <a href="#setBrush-2"><b>setBrush</b></a> ( TQColorGroup::ColorRole r, const TQBrush & b )</li>
|
|
<li class=fn>TQPalette <a href="#copy"><b>copy</b></a> () const</li>
|
|
<li class=fn>const TQColorGroup & <a href="#active"><b>active</b></a> () const</li>
|
|
<li class=fn>const TQColorGroup & <a href="#disabled"><b>disabled</b></a> () const</li>
|
|
<li class=fn>const TQColorGroup & <a href="#inactive"><b>inactive</b></a> () const</li>
|
|
<li class=fn>const TQColorGroup & normal () const <em>(obsolete)</em></li>
|
|
<li class=fn>void <a href="#setActive"><b>setActive</b></a> ( const TQColorGroup & g )</li>
|
|
<li class=fn>void <a href="#setDisabled"><b>setDisabled</b></a> ( const TQColorGroup & g )</li>
|
|
<li class=fn>void <a href="#setInactive"><b>setInactive</b></a> ( const TQColorGroup & g )</li>
|
|
<li class=fn>void setNormal ( const TQColorGroup & cg ) <em>(obsolete)</em></li>
|
|
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const TQPalette & p ) const</li>
|
|
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const TQPalette & p ) const</li>
|
|
<li class=fn>bool <a href="#isCopyOf"><b>isCopyOf</b></a> ( const TQPalette & p )</li>
|
|
<li class=fn>int <a href="#serialNumber"><b>serialNumber</b></a> () const</li>
|
|
</ul>
|
|
<h2>Related Functions</h2>
|
|
<ul>
|
|
<li class=fn>TQDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( TQDataStream & s, const TQPalette & p )</li>
|
|
<li class=fn>TQDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( TQDataStream & s, TQPalette & p )</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
<p> The TQPalette class contains color groups for each widget state.
|
|
<p>
|
|
|
|
|
|
|
|
|
|
<p> A palette consists of three color groups: <em>active</em>, <em>disabled</em>,
|
|
and <em>inactive</em>. All widgets contain a palette, and all widgets in
|
|
TQt use their palette to draw themselves. This makes the user
|
|
interface easily configurable and easier to keep consistent.
|
|
<p> If you create a new widget we strongly recommend that you use the
|
|
colors in the palette rather than hard-coding specific colors.
|
|
<p> The color groups:
|
|
<ul>
|
|
<li> The <a href="#active">active</a>() group is used for the window that has <a href="focus.html#keyboard-focus">keyboard focus</a>.
|
|
<li> The <a href="#inactive">inactive</a>() group is used for other windows.
|
|
<li> The <a href="#disabled">disabled</a>() group is used for widgets (not windows) that are
|
|
disabled for some reason.
|
|
</ul>
|
|
<p> Both active and inactive windows can contain disabled widgets.
|
|
(Disabled widgets are often called <em>inaccessible</em> or <em>grayed out</em>.)
|
|
<p> In <a href="motif-extension.html#Motif">Motif</a> style, active() and inactive() look the same. In Windows
|
|
2000 style and Macintosh Platinum style, the two styles look
|
|
slightly different.
|
|
<p> There are <a href="#setActive">setActive</a>(), <a href="#setInactive">setInactive</a>(), and <a href="#setDisabled">setDisabled</a>() functions
|
|
to modify the palette. (TQt also supports a <a href="#normal">normal</a>() group; this is
|
|
an obsolete alias for active(), supported for backwards
|
|
compatibility.)
|
|
<p> Colors and brushes can be set for particular roles in any of a
|
|
palette's color groups with <a href="#setColor">setColor</a>() and <a href="#setBrush">setBrush</a>().
|
|
<p> You can copy a palette using the copy constructor and test to see
|
|
if two palettes are <em>identical</em> using <a href="#isCopyOf">isCopyOf</a>().
|
|
<p> <p>See also <a href="ntqapplication.html#setPalette">TQApplication::setPalette</a>(), <a href="ntqwidget.html#palette-prop">TQWidget::palette</a>, <a href="qcolorgroup.html">TQColorGroup</a>, <a href="ntqcolor.html">TQColor</a>, <a href="appearance.html">Widget Appearance and Style</a>, <a href="graphics.html">Graphics Classes</a>, <a href="images.html">Image Processing Classes</a>, and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.
|
|
|
|
<hr><h2>Member Type Documentation</h2>
|
|
<h3 class=fn><a name="ColorGroup-enum"></a>TQPalette::ColorGroup</h3>
|
|
|
|
<ul>
|
|
<li><tt>TQPalette::Disabled</tt>
|
|
<li><tt>TQPalette::Active</tt>
|
|
<li><tt>TQPalette::Inactive</tt>
|
|
<li><tt>TQPalette::NColorGroups</tt>
|
|
<li><tt>TQPalette::Normal</tt> - synonym for Active
|
|
</ul>
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="TQPalette"></a>TQPalette::TQPalette ()
|
|
</h3>
|
|
Constructs a palette that consists of color groups with only black
|
|
colors.
|
|
|
|
<h3 class=fn><a name="TQPalette-2"></a>TQPalette::TQPalette ( const <a href="ntqcolor.html">TQColor</a> & button )
|
|
</h3><b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Constructs a palette from the <em>button</em> color. The other colors are
|
|
automatically calculated, based on this color. Background will be
|
|
the button color as well.
|
|
|
|
<h3 class=fn><a name="TQPalette-3"></a>TQPalette::TQPalette ( const <a href="ntqcolor.html">TQColor</a> & button, const <a href="ntqcolor.html">TQColor</a> & background )
|
|
</h3>
|
|
Constructs a palette from a <em>button</em> color and a <em>background</em>.
|
|
The other colors are automatically calculated, based on these
|
|
colors.
|
|
|
|
<h3 class=fn><a name="TQPalette-4"></a>TQPalette::TQPalette ( const <a href="qcolorgroup.html">TQColorGroup</a> & active, const <a href="qcolorgroup.html">TQColorGroup</a> & disabled, const <a href="qcolorgroup.html">TQColorGroup</a> & inactive )
|
|
</h3>
|
|
Constructs a palette that consists of the three color groups <em>active</em>, <em>disabled</em> and <em>inactive</em>. See the <a href="#details">Detailed Description</a> for definitions of the color groups
|
|
and <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a> for definitions of each color role
|
|
in the three groups.
|
|
<p> <p>See also <a href="qcolorgroup.html">TQColorGroup</a> and <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a>.
|
|
|
|
<h3 class=fn><a name="TQPalette-5"></a>TQPalette::TQPalette ( const <a href="ntqpalette.html">TQPalette</a> & p )
|
|
</h3>
|
|
Constructs a copy of <em>p</em>.
|
|
<p> This constructor is fast (it uses copy-on-write).
|
|
|
|
<h3 class=fn><a name="~TQPalette"></a>TQPalette::~TQPalette ()
|
|
</h3>
|
|
Destroys the palette.
|
|
|
|
<h3 class=fn>const <a href="qcolorgroup.html">TQColorGroup</a> & <a name="active"></a>TQPalette::active () const
|
|
</h3>
|
|
|
|
<p> Returns the active color group of this palette.
|
|
<p> <p>See also <a href="qcolorgroup.html">TQColorGroup</a>, <a href="#setActive">setActive</a>(), <a href="#inactive">inactive</a>(), and <a href="#disabled">disabled</a>().
|
|
|
|
<p>Examples: <a href="themes-example.html#x290">themes/metal.cpp</a> and <a href="themes-example.html#x224">themes/wood.cpp</a>.
|
|
<h3 class=fn>const <a href="ntqbrush.html">TQBrush</a> & <a name="brush"></a>TQPalette::brush ( <a href="ntqpalette.html#ColorGroup-enum">ColorGroup</a> gr, <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a> r ) const
|
|
</h3>
|
|
Returns the brush in color group <em>gr</em>, used for color role <em>r</em>.
|
|
<p> <p>See also <a href="#color">color</a>(), <a href="#setBrush">setBrush</a>(), and <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a>.
|
|
|
|
<h3 class=fn>const <a href="ntqcolor.html">TQColor</a> & <a name="color"></a>TQPalette::color ( <a href="ntqpalette.html#ColorGroup-enum">ColorGroup</a> gr, <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a> r ) const
|
|
</h3>
|
|
Returns the color in color group <em>gr</em>, used for color role <em>r</em>.
|
|
<p> <p>See also <a href="#brush">brush</a>(), <a href="#setColor">setColor</a>(), and <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a>.
|
|
|
|
<h3 class=fn><a href="ntqpalette.html">TQPalette</a> <a name="copy"></a>TQPalette::copy () const
|
|
</h3>
|
|
Returns a <a href="shclass.html#deep-copy">deep copy</a> of this palette.
|
|
<p> <b>Warning:</b> This is slower than the copy constructor and assignment
|
|
operator and offers no benefits.
|
|
|
|
<h3 class=fn>const <a href="qcolorgroup.html">TQColorGroup</a> & <a name="disabled"></a>TQPalette::disabled () const
|
|
</h3>
|
|
|
|
<p> Returns the disabled color group of this palette.
|
|
<p> <p>See also <a href="qcolorgroup.html">TQColorGroup</a>, <a href="#setDisabled">setDisabled</a>(), <a href="#active">active</a>(), and <a href="#inactive">inactive</a>().
|
|
|
|
<p>Examples: <a href="themes-example.html#x291">themes/metal.cpp</a> and <a href="themes-example.html#x225">themes/wood.cpp</a>.
|
|
<h3 class=fn>const <a href="qcolorgroup.html">TQColorGroup</a> & <a name="inactive"></a>TQPalette::inactive () const
|
|
</h3>
|
|
|
|
<p> Returns the inactive color group of this palette.
|
|
<p> <p>See also <a href="qcolorgroup.html">TQColorGroup</a>, <a href="#setInactive">setInactive</a>(), <a href="#active">active</a>(), and <a href="#disabled">disabled</a>().
|
|
|
|
<h3 class=fn>bool <a name="isCopyOf"></a>TQPalette::isCopyOf ( const <a href="ntqpalette.html">TQPalette</a> & p )
|
|
</h3>
|
|
Returns TRUE if this palette and <em>p</em> are copies of each other,
|
|
i.e. one of them was created as a copy of the other and neither
|
|
was subsequently modified; otherwise returns FALSE. This is much
|
|
stricter than equality.
|
|
<p> <p>See also <a href="#operator-eq">operator=</a>() and <a href="#operator-eq-eq">operator==</a>().
|
|
|
|
<h3 class=fn>const <a href="qcolorgroup.html">TQColorGroup</a> & <a name="normal"></a>TQPalette::normal () const
|
|
</h3>
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p>
|
|
<p> Returns the active color group. Use <a href="#active">active</a>() instead.
|
|
<p> <p>See also <a href="#setActive">setActive</a>() and <a href="#active">active</a>().
|
|
|
|
<h3 class=fn>bool <a name="operator!-eq"></a>TQPalette::operator!= ( const <a href="ntqpalette.html">TQPalette</a> & p ) const
|
|
</h3>
|
|
|
|
<p> Returns TRUE (slowly) if this palette is different from <em>p</em>;
|
|
otherwise returns FALSE (usually quickly).
|
|
|
|
<h3 class=fn><a href="ntqpalette.html">TQPalette</a> & <a name="operator-eq"></a>TQPalette::operator= ( const <a href="ntqpalette.html">TQPalette</a> & p )
|
|
</h3>
|
|
Assigns <em>p</em> to this palette and returns a reference to this
|
|
palette.
|
|
<p> This is fast (it uses copy-on-write).
|
|
<p> <p>See also <a href="#copy">copy</a>().
|
|
|
|
<h3 class=fn>bool <a name="operator-eq-eq"></a>TQPalette::operator== ( const <a href="ntqpalette.html">TQPalette</a> & p ) const
|
|
</h3>
|
|
Returns TRUE (usually quickly) if this palette is equal to <em>p</em>;
|
|
otherwise returns FALSE (slowly).
|
|
|
|
<h3 class=fn>int <a name="serialNumber"></a>TQPalette::serialNumber () const
|
|
</h3>
|
|
|
|
<p> Returns a number that uniquely identifies this TQPalette object.
|
|
The serial number is intended for caching. Its value may not be
|
|
used for anything other than equality testing.
|
|
<p> Note that TQPalette uses copy-on-write, and the serial number
|
|
changes during the lazy copy operation (detach()), not during a
|
|
<a href="shclass.html#shallow-copy">shallow copy</a> (copy constructor or assignment).
|
|
<p> <p>See also <a href="ntqpixmap.html">TQPixmap</a>, <a href="ntqpixmapcache.html">TQPixmapCache</a>, and <a href="ntqcache.html">TQCache</a>.
|
|
|
|
<h3 class=fn>void <a name="setActive"></a>TQPalette::setActive ( const <a href="qcolorgroup.html">TQColorGroup</a> & g )
|
|
</h3>
|
|
Sets the <a href="#ColorGroup-enum">Active</a> color group to <em>g</em>.
|
|
<p> <p>See also <a href="#active">active</a>(), <a href="#setDisabled">setDisabled</a>(), <a href="#setInactive">setInactive</a>(), and <a href="qcolorgroup.html">TQColorGroup</a>.
|
|
|
|
<h3 class=fn>void <a name="setBrush"></a>TQPalette::setBrush ( <a href="ntqpalette.html#ColorGroup-enum">ColorGroup</a> gr, <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a> r, const <a href="ntqbrush.html">TQBrush</a> & b )
|
|
</h3>
|
|
Sets the brush in color group <em>gr</em>, used for color role <em>r</em>, to
|
|
<em>b</em>.
|
|
<p> <p>See also <a href="#brush">brush</a>(), <a href="#setColor">setColor</a>(), and <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a>.
|
|
|
|
<h3 class=fn>void <a name="setBrush-2"></a>TQPalette::setBrush ( <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a> r, const <a href="ntqbrush.html">TQBrush</a> & b )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Sets the brush in for color role <em>r</em> in all three color groups to
|
|
<em>b</em>.
|
|
<p> <p>See also <a href="#brush">brush</a>(), <a href="#setColor">setColor</a>(), <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a>, <a href="#active">active</a>(), <a href="#inactive">inactive</a>(), and <a href="#disabled">disabled</a>().
|
|
|
|
<h3 class=fn>void <a name="setColor"></a>TQPalette::setColor ( <a href="ntqpalette.html#ColorGroup-enum">ColorGroup</a> gr, <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a> r, const <a href="ntqcolor.html">TQColor</a> & c )
|
|
</h3>
|
|
Sets the brush in color group <em>gr</em>, used for color role <em>r</em>, to
|
|
the solid color <em>c</em>.
|
|
<p> <p>See also <a href="#setBrush">setBrush</a>(), <a href="#color">color</a>(), and <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a>.
|
|
|
|
<p>Example: <a href="themes-example.html#x332">themes/themes.cpp</a>.
|
|
<h3 class=fn>void <a name="setColor-2"></a>TQPalette::setColor ( <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a> r, const <a href="ntqcolor.html">TQColor</a> & c )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Sets the brush color used for color role <em>r</em> to color <em>c</em> in all
|
|
three color groups.
|
|
<p> <p>See also <a href="#color">color</a>(), <a href="#setBrush">setBrush</a>(), and <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a>.
|
|
|
|
<h3 class=fn>void <a name="setDisabled"></a>TQPalette::setDisabled ( const <a href="qcolorgroup.html">TQColorGroup</a> & g )
|
|
</h3>
|
|
Sets the <a href="#ColorGroup-enum">Disabled</a> color group to <em>g</em>.
|
|
<p> <p>See also <a href="#disabled">disabled</a>(), <a href="#setActive">setActive</a>(), and <a href="#setInactive">setInactive</a>().
|
|
|
|
<h3 class=fn>void <a name="setInactive"></a>TQPalette::setInactive ( const <a href="qcolorgroup.html">TQColorGroup</a> & g )
|
|
</h3>
|
|
Sets the <a href="#ColorGroup-enum">Inactive</a> color group to <em>g</em>.
|
|
<p> <p>See also <a href="#active">active</a>(), <a href="#setDisabled">setDisabled</a>(), <a href="#setActive">setActive</a>(), and <a href="qcolorgroup.html">TQColorGroup</a>.
|
|
|
|
<h3 class=fn>void <a name="setNormal"></a>TQPalette::setNormal ( const <a href="qcolorgroup.html">TQColorGroup</a> & cg )
|
|
</h3>
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p>
|
|
<p> Sets the active color group to <em>cg</em>. Use <a href="#setActive">setActive</a>() instead.
|
|
<p> <p>See also <a href="#setActive">setActive</a>() and <a href="#active">active</a>().
|
|
|
|
<hr><h2>Related Functions</h2>
|
|
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="ntqdatastream.html">TQDataStream</a> & s, const <a href="ntqpalette.html">TQPalette</a> & p )
|
|
</h3>
|
|
|
|
<p> Writes the palette, <em>p</em> to the stream <em>s</em> and returns a
|
|
reference to the stream.
|
|
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
|
|
|
|
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="ntqdatastream.html">TQDataStream</a> & s, <a href="ntqpalette.html">TQPalette</a> & p )
|
|
</h3>
|
|
|
|
<p> Reads a palette from the stream, <em>s</em> into the palette <em>p</em>, and
|
|
returns a reference to the stream.
|
|
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
|
|
|
|
<!-- eof -->
|
|
<hr><p>
|
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
|
Copyright © 1995-2007
|
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>TQt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|