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.
329 lines
20 KiB
329 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/qiconset.cpp:204 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>TQIconSet 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>TQIconSet Class Reference</h1>
|
|
|
|
<p>The TQIconSet class provides a set of icons with different
|
|
styles and sizes.
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="qiconset-h.html">ntqiconset.h</a>></tt>
|
|
<p><a href="qiconset-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn>enum <a href="#Size-enum"><b>Size</b></a> { Automatic, Small, Large }</li>
|
|
<li class=fn>enum <a href="#Mode-enum"><b>Mode</b></a> { Normal, Disabled, Active }</li>
|
|
<li class=fn>enum <a href="#State-enum"><b>State</b></a> { On, Off }</li>
|
|
<li class=fn><a href="#TQIconSet"><b>TQIconSet</b></a> ()</li>
|
|
<li class=fn><a href="#TQIconSet-2"><b>TQIconSet</b></a> ( const TQPixmap & pixmap, Size size = Automatic )</li>
|
|
<li class=fn><a href="#TQIconSet-3"><b>TQIconSet</b></a> ( const TQPixmap & smallPix, const TQPixmap & largePix )</li>
|
|
<li class=fn><a href="#TQIconSet-4"><b>TQIconSet</b></a> ( const TQIconSet & other )</li>
|
|
<li class=fn>virtual <a href="#~TQIconSet"><b>~TQIconSet</b></a> ()</li>
|
|
<li class=fn>void <a href="#reset"><b>reset</b></a> ( const TQPixmap & pixmap, Size size )</li>
|
|
<li class=fn>virtual void <a href="#setPixmap"><b>setPixmap</b></a> ( const TQPixmap & pixmap, Size size, Mode mode = Normal, State state = Off )</li>
|
|
<li class=fn>virtual void <a href="#setPixmap-2"><b>setPixmap</b></a> ( const TQString & fileName, Size size, Mode mode = Normal, State state = Off )</li>
|
|
<li class=fn>TQPixmap <a href="#pixmap"><b>pixmap</b></a> ( Size size, Mode mode, State state = Off ) const</li>
|
|
<li class=fn>TQPixmap pixmap ( Size size, bool enabled, State state = Off ) const <em>(obsolete)</em></li>
|
|
<li class=fn>TQPixmap <a href="#pixmap-3"><b>pixmap</b></a> () const</li>
|
|
<li class=fn>bool <a href="#isGenerated"><b>isGenerated</b></a> ( Size size, Mode mode, State state = Off ) const</li>
|
|
<li class=fn>void <a href="#clearGenerated"><b>clearGenerated</b></a> ()</li>
|
|
<li class=fn>void <a href="#installIconFactory"><b>installIconFactory</b></a> ( TQIconFactory * factory )</li>
|
|
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
|
|
<li class=fn>void <a href="#detach"><b>detach</b></a> ()</li>
|
|
<li class=fn>TQIconSet & <a href="#operator-eq"><b>operator=</b></a> ( const TQIconSet & other )</li>
|
|
</ul>
|
|
<h2>Static Public Members</h2>
|
|
<ul>
|
|
<li class=fn>void <a href="#setIconSize"><b>setIconSize</b></a> ( Size which, const TQSize & size )</li>
|
|
<li class=fn>const TQSize & <a href="#iconSize"><b>iconSize</b></a> ( Size which )</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
<p> The TQIconSet class provides a set of icons with different
|
|
styles and sizes.
|
|
<p>
|
|
|
|
|
|
|
|
<p> A TQIconSet can generate smaller, larger, active, and disabled pixmaps
|
|
from the set of icons it is given. Such pixmaps are used by
|
|
<a href="ntqtoolbutton.html">TQToolButton</a>, <a href="ntqheader.html">TQHeader</a>, <a href="ntqpopupmenu.html">TQPopupMenu</a>, etc. to show an icon representing a
|
|
particular action.
|
|
<p> The simplest use of TQIconSet is to create one from a <a href="ntqpixmap.html">TQPixmap</a> and then
|
|
use it, allowing TQt to work out all the required icon styles and
|
|
sizes. For example:
|
|
<p> <pre>
|
|
<a href="ntqtoolbutton.html">TQToolButton</a> *but = new <a href="ntqtoolbutton.html">TQToolButton</a>( <a href="#TQIconSet">TQIconSet</a>( TQPixmap("open.xpm") ), ... );
|
|
</pre>
|
|
|
|
<p> Using whichever pixmaps you specify as a base, TQIconSet provides a
|
|
set of six icons, each with a <a href="#Size-enum">Size</a> and a <a href="#Mode-enum">Mode</a>: Small Normal,
|
|
Small Disabled, Small Active, Large Normal, Large Disabled, and
|
|
Large Active.
|
|
<p> An additional set of six icons can be provided for widgets that have
|
|
an "On" or "Off" state, like checkable menu items or toggleable
|
|
toolbuttons. If you provide pixmaps for the "On" state, but not for
|
|
the "Off" state, the TQIconSet will provide the "Off" pixmaps. You may
|
|
specify icons for both states in you wish.
|
|
<p> You can set any of the icons using <a href="#setPixmap">setPixmap</a>().
|
|
<p> When you retrieve a pixmap using <a href="#pixmap">pixmap</a>(Size, Mode, State),
|
|
TQIconSet will return the icon that has been set or previously
|
|
generated for that size, mode and state combination. If none is
|
|
available, TQIconSet will ask the icon factory. If the icon factory
|
|
cannot provide any (the default), TQIconSet generates a pixmap based
|
|
on the pixmaps it has been given and returns it.
|
|
<p> The <a href="#Mode-enum">Disabled</a> appearance is computed using an algorithm that
|
|
produces results very similar to those used in Microsoft Windows
|
|
95. The <a href="#Mode-enum">Active</a> appearance is identical to the <a href="#Mode-enum">Normal</a>
|
|
appearance unless you use setPixmap() to set it to something
|
|
special.
|
|
<p> When scaling icons, TQIconSet uses <a href="ntqimage.html#smoothScale">smooth scaling</a>, which can partially blend the color component
|
|
of pixmaps. If the results look poor, the best solution
|
|
is to supply pixmaps in both large and small sizes.
|
|
<p> You can use the static function <a href="#setIconSize">setIconSize</a>() to set the preferred
|
|
size of the generated large/small icons. The default small size is
|
|
22 x 22, while the default large size is 32 x 32. These sizes only
|
|
affect generated icons.
|
|
<p> The <a href="#isGenerated">isGenerated</a>() function returns TRUE if an icon was generated by
|
|
TQIconSet or by a factory; <a href="#clearGenerated">clearGenerated</a>() clears all cached
|
|
pixmaps.
|
|
<p> <h3> Making Classes that Use TQIconSet
|
|
</h3>
|
|
<a name="1"></a><p> If you write your own widgets that have an option to set a small
|
|
pixmap, consider allowing a TQIconSet to be set for that pixmap. The
|
|
TQt class <a href="ntqtoolbutton.html">TQToolButton</a> is an example of such a widget.
|
|
<p> Provide a method to set a TQIconSet, and when you draw the icon, choose
|
|
whichever icon is appropriate for the current state of your widget.
|
|
For example:
|
|
<pre>
|
|
void MyWidget::drawIcon( <a href="ntqpainter.html">TQPainter</a>* p, TQPoint pos )
|
|
{
|
|
p-><a href="ntqpainter.html#drawPixmap">drawPixmap</a>( pos, icons->pixmap(
|
|
TQIconSet::<a href="#Size-enum">Small</a>,
|
|
isEnabled() ? TQIconSet::<a href="#Mode-enum">Normal</a> :
|
|
TQIconSet::<a href="#Mode-enum">Disabled</a>,
|
|
isEnabled() ? TQIconSet::<a href="#State-enum">On</a> :
|
|
TQIconSet::<a href="#State-enum">Off</a>));
|
|
}
|
|
</pre>
|
|
|
|
<p> You might also make use of the <a href="#Mode-enum">Active</a> mode, perhaps making your
|
|
widget <a href="#Mode-enum">Active</a> when the mouse is over the widget (see <a href="ntqwidget.html#enterEvent">TQWidget::enterEvent</a>()), while the mouse is pressed pending the
|
|
release that will activate the function, or when it is the currently
|
|
selected item. If the widget can be toggled, the "On" mode might be
|
|
used to draw a different icon.
|
|
<p> <center><img src="iconset.png" alt="TQIconSet"></center>
|
|
<p> <p>See also <a href="qiconfactory.html">TQIconFactory</a>, <a href="ntqpixmap.html">TQPixmap</a>, <a href="ntqmainwindow.html#usesBigPixmaps-prop">TQMainWindow::usesBigPixmaps</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Iconic Label</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="Mode-enum"></a>TQIconSet::Mode</h3>
|
|
|
|
<p> This enum type describes the mode for which a pixmap is intended to be
|
|
used.
|
|
The currently defined modes are:
|
|
<ul>
|
|
<li><tt>TQIconSet::Normal</tt> -
|
|
Display the pixmap when the user is
|
|
not interacting with the icon, but the
|
|
functionality represented by the icon is available.
|
|
<li><tt>TQIconSet::Disabled</tt> -
|
|
Display the pixmap when the
|
|
functionality represented by the icon is not available.
|
|
<li><tt>TQIconSet::Active</tt> -
|
|
Display the pixmap when the
|
|
functionality represented by the icon is available and
|
|
the user is interacting with the icon, for example, moving the
|
|
mouse over it or clicking it.
|
|
</ul>
|
|
<h3 class=fn><a name="Size-enum"></a>TQIconSet::Size</h3>
|
|
|
|
<p> This enum type describes the size at which a pixmap is intended to be
|
|
used.
|
|
The currently defined sizes are:
|
|
<ul>
|
|
<li><tt>TQIconSet::Automatic</tt> - The size of the pixmap is determined from its
|
|
pixel size. This is a useful default.
|
|
<li><tt>TQIconSet::Small</tt> - The pixmap is the smaller of two.
|
|
<li><tt>TQIconSet::Large</tt> - The pixmap is the larger of two.
|
|
</ul><p> If a Small pixmap is not set by <a href="#setPixmap">TQIconSet::setPixmap</a>(), the Large
|
|
pixmap will be automatically scaled down to the size of a small pixmap
|
|
to generate the Small pixmap when required. Similarly, a Small pixmap
|
|
will be automatically scaled up to generate a Large pixmap. The
|
|
preferred sizes for large/small generated icons can be set using
|
|
<a href="#setIconSize">setIconSize</a>().
|
|
<p> <p>See also <a href="#setIconSize">setIconSize</a>(), <a href="#iconSize">iconSize</a>(), <a href="#setPixmap">setPixmap</a>(), <a href="#pixmap">pixmap</a>(), and <a href="ntqmainwindow.html#usesBigPixmaps-prop">TQMainWindow::usesBigPixmaps</a>.
|
|
|
|
<h3 class=fn><a name="State-enum"></a>TQIconSet::State</h3>
|
|
|
|
<p> This enum describes the state for which a pixmap is intended to be
|
|
used. The <em>state</em> can be:
|
|
<ul>
|
|
<li><tt>TQIconSet::Off</tt> - Display the pixmap when the widget is in an "off" state
|
|
<li><tt>TQIconSet::On</tt> - Display the pixmap when the widget is in an "on" state
|
|
</ul><p> <p>See also <a href="#setPixmap">setPixmap</a>() and <a href="#pixmap">pixmap</a>().
|
|
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="TQIconSet"></a>TQIconSet::TQIconSet ()
|
|
</h3>
|
|
Constructs a null icon set.
|
|
<p> <p>See also <a href="#setPixmap">setPixmap</a>() and <a href="#reset">reset</a>().
|
|
|
|
<h3 class=fn><a name="TQIconSet-2"></a>TQIconSet::TQIconSet ( const <a href="ntqpixmap.html">TQPixmap</a> & pixmap, <a href="ntqiconset.html#Size-enum">Size</a> size = Automatic )
|
|
</h3>
|
|
Constructs an icon set for which the Normal pixmap is <em>pixmap</em>,
|
|
which is assumed to be of size <em>size</em>.
|
|
<p> The default for <em>size</em> is <a href="#Size-enum">Automatic</a>, which means that TQIconSet
|
|
will determine whether the pixmap is Small or Large from its pixel
|
|
size. Pixmaps less than the width of a small generated icon are
|
|
considered to be Small. You can use <a href="#setIconSize">setIconSize</a>() to set the
|
|
preferred size of a generated icon.
|
|
<p> <p>See also <a href="#setIconSize">setIconSize</a>() and <a href="#reset">reset</a>().
|
|
|
|
<h3 class=fn><a name="TQIconSet-3"></a>TQIconSet::TQIconSet ( const <a href="ntqpixmap.html">TQPixmap</a> & smallPix, const <a href="ntqpixmap.html">TQPixmap</a> & largePix )
|
|
</h3> Creates an iconset which uses the pixmap <em>smallPix</em> for for
|
|
displaying a small icon, and the pixmap <em>largePix</em> for displaying a
|
|
large icon.
|
|
|
|
<h3 class=fn><a name="TQIconSet-4"></a>TQIconSet::TQIconSet ( const <a href="ntqiconset.html">TQIconSet</a> & other )
|
|
</h3>
|
|
Constructs a copy of <em>other</em>. This is very fast.
|
|
|
|
<h3 class=fn><a name="~TQIconSet"></a>TQIconSet::~TQIconSet ()<tt> [virtual]</tt>
|
|
</h3>
|
|
Destroys the icon set and frees any allocated resources.
|
|
|
|
<h3 class=fn>void <a name="clearGenerated"></a>TQIconSet::clearGenerated ()
|
|
</h3>
|
|
Clears all cached pixmaps, including those obtained from an
|
|
eventual <a href="qiconfactory.html">TQIconFactory</a>.
|
|
|
|
<h3 class=fn>void <a name="detach"></a>TQIconSet::detach ()
|
|
</h3>
|
|
Detaches this icon set from others with which it may share data.
|
|
<p> You will never need to call this function; other TQIconSet functions
|
|
call it as necessary.
|
|
|
|
<h3 class=fn>const <a href="ntqsize.html">TQSize</a> & <a name="iconSize"></a>TQIconSet::iconSize ( <a href="ntqiconset.html#Size-enum">Size</a> which )<tt> [static]</tt>
|
|
</h3>
|
|
If <em>which</em> is Small, returns the preferred size of a small
|
|
generated icon; if <em>which</em> is Large, returns the preferred size
|
|
of a large generated icon.
|
|
<p> <p>See also <a href="#setIconSize">setIconSize</a>().
|
|
|
|
<h3 class=fn>void <a name="installIconFactory"></a>TQIconSet::installIconFactory ( <a href="qiconfactory.html">TQIconFactory</a> * factory )
|
|
</h3>
|
|
Installs <em>factory</em> as the icon factory for this iconset. The
|
|
icon factory is used to generates pixmaps not set by the user.
|
|
<p> If no icon factory is installed, <a href="qiconfactory.html#defaultFactory">TQIconFactory::defaultFactory</a>()
|
|
is used.
|
|
|
|
<h3 class=fn>bool <a name="isGenerated"></a>TQIconSet::isGenerated ( <a href="ntqiconset.html#Size-enum">Size</a> size, <a href="ntqiconset.html#Mode-enum">Mode</a> mode, <a href="ntqiconset.html#State-enum">State</a> state = Off ) const
|
|
</h3>
|
|
Returns TRUE if the pixmap with size <em>size</em>, mode <em>mode</em> and
|
|
state <em>state</em> is generated from other pixmaps; otherwise returns
|
|
FALSE.
|
|
<p> A pixmap obtained from a <a href="qiconfactory.html">TQIconFactory</a> is considered non-generated.
|
|
|
|
<h3 class=fn>bool <a name="isNull"></a>TQIconSet::isNull () const
|
|
</h3>
|
|
Returns TRUE if the icon set is empty; otherwise returns FALSE.
|
|
|
|
<h3 class=fn><a href="ntqiconset.html">TQIconSet</a> & <a name="operator-eq"></a>TQIconSet::operator= ( const <a href="ntqiconset.html">TQIconSet</a> & other )
|
|
</h3>
|
|
Assigns <em>other</em> to this icon set and returns a reference to this
|
|
icon set.
|
|
<p> <p>See also <a href="#detach">detach</a>().
|
|
|
|
<h3 class=fn><a href="ntqpixmap.html">TQPixmap</a> <a name="pixmap"></a>TQIconSet::pixmap ( <a href="ntqiconset.html#Size-enum">Size</a> size, <a href="ntqiconset.html#Mode-enum">Mode</a> mode, <a href="ntqiconset.html#State-enum">State</a> state = Off ) const
|
|
</h3>
|
|
Returns a pixmap with size <em>size</em>, mode <em>mode</em> and state <em>state</em>, generating one if necessary. Generated pixmaps are cached.
|
|
|
|
<h3 class=fn><a href="ntqpixmap.html">TQPixmap</a> <a name="pixmap-2"></a>TQIconSet::pixmap ( <a href="ntqiconset.html#Size-enum">Size</a> size, bool enabled, <a href="ntqiconset.html#State-enum">State</a> state = Off ) const
|
|
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> This is the same as <a href="#pixmap">pixmap</a>(<em>size</em>, <em>enabled</em>, <em>state</em>).
|
|
|
|
<h3 class=fn><a href="ntqpixmap.html">TQPixmap</a> <a name="pixmap-3"></a>TQIconSet::pixmap () const
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Returns the pixmap originally provided to the constructor or to
|
|
<a href="#reset">reset</a>(). This is the Normal pixmap of unspecified Size.
|
|
<p> <p>See also <a href="#reset">reset</a>().
|
|
|
|
<h3 class=fn>void <a name="reset"></a>TQIconSet::reset ( const <a href="ntqpixmap.html">TQPixmap</a> & pixmap, <a href="ntqiconset.html#Size-enum">Size</a> size )
|
|
</h3>
|
|
Sets this icon set to use pixmap <em>pixmap</em> for the Normal pixmap,
|
|
assuming it to be of size <em>size</em>.
|
|
<p> This is equivalent to assigning TQIconSet(<em>pixmap</em>, <em>size</em>) to this
|
|
icon set.
|
|
<p> This function does nothing if <em>pixmap</em> is a null pixmap.
|
|
|
|
<h3 class=fn>void <a name="setIconSize"></a>TQIconSet::setIconSize ( <a href="ntqiconset.html#Size-enum">Size</a> which, const <a href="ntqsize.html">TQSize</a> & size )<tt> [static]</tt>
|
|
</h3>
|
|
Set the preferred size for all small or large icons that are
|
|
generated after this call. If <em>which</em> is Small, sets the preferred
|
|
size of small generated icons to <em>size</em>. Similarly, if <em>which</em> is
|
|
Large, sets the preferred size of large generated icons to <em>size</em>.
|
|
<p> Note that cached icons will not be regenerated, so it is recommended
|
|
that you set the preferred icon sizes before generating any icon sets.
|
|
Also note that the preferred icon sizes will be ignored for icon sets
|
|
that have been created using both small and large pixmaps.
|
|
<p> <p>See also <a href="#iconSize">iconSize</a>().
|
|
|
|
<h3 class=fn>void <a name="setPixmap"></a>TQIconSet::setPixmap ( const <a href="ntqpixmap.html">TQPixmap</a> & pixmap, <a href="ntqiconset.html#Size-enum">Size</a> size, <a href="ntqiconset.html#Mode-enum">Mode</a> mode = Normal, <a href="ntqiconset.html#State-enum">State</a> state = Off )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets this icon set to provide pixmap <em>pixmap</em> for size <em>size</em>, mode <em>mode</em> and state <em>state</em>. The icon set may also use <em>pixmap</em> for
|
|
generating other pixmaps if they are not explicitly set.
|
|
<p> The <em>size</em> can be one of Automatic, Large or Small. If Automatic is
|
|
used, TQIconSet will determine if the pixmap is Small or Large from its
|
|
pixel size.
|
|
<p> Pixmaps less than the width of a small generated icon are
|
|
considered to be Small. You can use <a href="#setIconSize">setIconSize</a>() to set the preferred
|
|
size of a generated icon.
|
|
<p> This function does nothing if <em>pixmap</em> is a null pixmap.
|
|
<p> <p>See also <a href="#reset">reset</a>().
|
|
|
|
<h3 class=fn>void <a name="setPixmap-2"></a>TQIconSet::setPixmap ( const <a href="ntqstring.html">TQString</a> & fileName, <a href="ntqiconset.html#Size-enum">Size</a> size, <a href="ntqiconset.html#Mode-enum">Mode</a> mode = Normal, <a href="ntqiconset.html#State-enum">State</a> state = Off )<tt> [virtual]</tt>
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> The pixmap is loaded from <em>fileName</em> when it becomes necessary.
|
|
|
|
<!-- 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>
|