1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
<!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 }</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>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>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.
<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>
</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>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>.
<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>
|