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.
tqt3/doc/html/ntqpalette.html

290 lines
18 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&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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 &lt;<a href="qpalette-h.html">ntqpalette.h</a>&gt;</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&nbsp;TQColor&nbsp;&amp;&nbsp;button ) &nbsp;<em>(obsolete)</em></li>
<li class=fn><a href="#TQPalette-3"><b>TQPalette</b></a> ( const&nbsp;TQColor&nbsp;&amp;&nbsp;button, const&nbsp;TQColor&nbsp;&amp;&nbsp;background )</li>
<li class=fn><a href="#TQPalette-4"><b>TQPalette</b></a> ( const&nbsp;TQColorGroup&nbsp;&amp;&nbsp;active, const&nbsp;TQColorGroup&nbsp;&amp;&nbsp;disabled, const&nbsp;TQColorGroup&nbsp;&amp;&nbsp;inactive )</li>
<li class=fn><a href="#TQPalette-5"><b>TQPalette</b></a> ( const&nbsp;TQPalette&nbsp;&amp;&nbsp;p )</li>
<li class=fn><a href="#~TQPalette"><b>~TQPalette</b></a> ()</li>
<li class=fn>TQPalette &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;TQPalette&nbsp;&amp;&nbsp;p )</li>
<li class=fn>enum <a href="#ColorGroup-enum"><b>ColorGroup</b></a> { Disabled, Active, Inactive, NColorGroups }</li>
<li class=fn>const TQColor &amp; <a href="#color"><b>color</b></a> ( ColorGroup&nbsp;gr, TQColorGroup::ColorRole&nbsp;r ) const</li>
<li class=fn>const TQBrush &amp; <a href="#brush"><b>brush</b></a> ( ColorGroup&nbsp;gr, TQColorGroup::ColorRole&nbsp;r ) const</li>
<li class=fn>void <a href="#setColor"><b>setColor</b></a> ( ColorGroup&nbsp;gr, TQColorGroup::ColorRole&nbsp;r, const&nbsp;TQColor&nbsp;&amp;&nbsp;c )</li>
<li class=fn>void <a href="#setBrush"><b>setBrush</b></a> ( ColorGroup&nbsp;gr, TQColorGroup::ColorRole&nbsp;r, const&nbsp;TQBrush&nbsp;&amp;&nbsp;b )</li>
<li class=fn>void <a href="#setColor-2"><b>setColor</b></a> ( TQColorGroup::ColorRole&nbsp;r, const&nbsp;TQColor&nbsp;&amp;&nbsp;c )</li>
<li class=fn>void <a href="#setBrush-2"><b>setBrush</b></a> ( TQColorGroup::ColorRole&nbsp;r, const&nbsp;TQBrush&nbsp;&amp;&nbsp;b )</li>
<li class=fn>TQPalette <a href="#copy"><b>copy</b></a> () const</li>
<li class=fn>const TQColorGroup &amp; <a href="#active"><b>active</b></a> () const</li>
<li class=fn>const TQColorGroup &amp; <a href="#disabled"><b>disabled</b></a> () const</li>
<li class=fn>const TQColorGroup &amp; <a href="#inactive"><b>inactive</b></a> () const</li>
<li class=fn>void <a href="#setActive"><b>setActive</b></a> ( const&nbsp;TQColorGroup&nbsp;&amp;&nbsp;g )</li>
<li class=fn>void <a href="#setDisabled"><b>setDisabled</b></a> ( const&nbsp;TQColorGroup&nbsp;&amp;&nbsp;g )</li>
<li class=fn>void <a href="#setInactive"><b>setInactive</b></a> ( const&nbsp;TQColorGroup&nbsp;&amp;&nbsp;g )</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;TQPalette&nbsp;&amp;&nbsp;p ) const</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;TQPalette&nbsp;&amp;&nbsp;p ) const</li>
<li class=fn>bool <a href="#isCopyOf"><b>isCopyOf</b></a> ( const&nbsp;TQPalette&nbsp;&amp;&nbsp;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 &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( TQDataStream&nbsp;&amp;&nbsp;s, const&nbsp;TQPalette&nbsp;&amp;&nbsp;p )</li>
<li class=fn>TQDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( TQDataStream&nbsp;&amp;&nbsp;s, TQPalette&nbsp;&amp;&nbsp;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.
<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="tqwidget.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>
</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&nbsp;<a href="ntqcolor.html">TQColor</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="ntqcolor.html">TQColor</a>&nbsp;&amp;&nbsp;button, const&nbsp;<a href="ntqcolor.html">TQColor</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="qcolorgroup.html">TQColorGroup</a>&nbsp;&amp;&nbsp;active, const&nbsp;<a href="qcolorgroup.html">TQColorGroup</a>&nbsp;&amp;&nbsp;disabled, const&nbsp;<a href="qcolorgroup.html">TQColorGroup</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="ntqpalette.html">TQPalette</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="qcolorgroup.html">TQColorGroup</a>&nbsp;&amp; <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&nbsp;<a href="ntqbrush.html">TQBrush</a>&nbsp;&amp; <a name="brush"></a>TQPalette::brush ( <a href="ntqpalette.html#ColorGroup-enum">ColorGroup</a>&nbsp;gr, <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a>&nbsp;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&nbsp;<a href="ntqcolor.html">TQColor</a>&nbsp;&amp; <a name="color"></a>TQPalette::color ( <a href="ntqpalette.html#ColorGroup-enum">ColorGroup</a>&nbsp;gr, <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a>&nbsp;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&nbsp;<a href="qcolorgroup.html">TQColorGroup</a>&nbsp;&amp; <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&nbsp;<a href="qcolorgroup.html">TQColorGroup</a>&nbsp;&amp; <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&nbsp;<a href="ntqpalette.html">TQPalette</a>&nbsp;&amp;&nbsp;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>bool <a name="operator!-eq"></a>TQPalette::operator!= ( const&nbsp;<a href="ntqpalette.html">TQPalette</a>&nbsp;&amp;&nbsp;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>&nbsp;&amp; <a name="operator-eq"></a>TQPalette::operator= ( const&nbsp;<a href="ntqpalette.html">TQPalette</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="ntqpalette.html">TQPalette</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="qcolorgroup.html">TQColorGroup</a>&nbsp;&amp;&nbsp;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>&nbsp;gr, <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a>&nbsp;r, const&nbsp;<a href="ntqbrush.html">TQBrush</a>&nbsp;&amp;&nbsp;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>&nbsp;r, const&nbsp;<a href="ntqbrush.html">TQBrush</a>&nbsp;&amp;&nbsp;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>&nbsp;gr, <a href="qcolorgroup.html#ColorRole-enum">TQColorGroup::ColorRole</a>&nbsp;r, const&nbsp;<a href="ntqcolor.html">TQColor</a>&nbsp;&amp;&nbsp;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>&nbsp;r, const&nbsp;<a href="ntqcolor.html">TQColor</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="qcolorgroup.html">TQColorGroup</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="qcolorgroup.html">TQColorGroup</a>&nbsp;&amp;&nbsp;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>.
<hr><h2>Related Functions</h2>
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="ntqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="ntqpalette.html">TQPalette</a>&nbsp;&amp;&nbsp;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>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="ntqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, <a href="ntqpalette.html">TQPalette</a>&nbsp;&amp;&nbsp;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 &copy; 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 &copy; 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>