Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1011

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/widgets/qmenudata.cpp:1318 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QCustomMenuItem Class</title>
<style type="text/css"><!--
h3.fn,span.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>QCustomMenuItem Class Reference</h1>

<p>The QCustomMenuItem class is an abstract base class for custom menu items in popup menus.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qmenudata-h.html">qmenudata.h</a>&gt;</tt>
<p>Inherits <a href="qt.html">Qt</a>.
<p><a href="qcustommenuitem-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class=fn><a href="#QCustomMenuItem"><b>QCustomMenuItem</b></a> ()</div></li>
<li><div class=fn>virtual <a href="#~QCustomMenuItem"><b>~QCustomMenuItem</b></a> ()</div></li>
<li><div class=fn>virtual bool <a href="#fullSpan"><b>fullSpan</b></a> () const</div></li>
<li><div class=fn>virtual bool <a href="#isSeparator"><b>isSeparator</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setFont"><b>setFont</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;font )</div></li>
<li><div class=fn>virtual void <a href="#paint"><b>paint</b></a> ( QPainter&nbsp;*&nbsp;p, const&nbsp;QColorGroup&nbsp;&amp;&nbsp;cg, bool&nbsp;act, bool&nbsp;enabled, int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h ) = 0</div></li>
<li><div class=fn>virtual QSize <a href="#sizeHint"><b>sizeHint</b></a> () = 0</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>



The QCustomMenuItem class is an abstract base class for custom menu items in popup menus.
<p> A custom menu item is a menu item that is defined by two purely virtual
functions, <a href="#paint">paint</a>() and <a href="#sizeHint">sizeHint</a>(). The size hint tells the menu how much
space it needs to reserve for this item, and paint is called
whenever the item needs painting.
<p> This simple mechanism allows you to create all kinds of application
specific menu items. Examples are items showing different fonts in a
word processor or menus that allow the selection of drawing utilities
in a vector drawing program.
<p> A custom item is inserted into a popup menu with
<a href="qmenudata.html#insertItem">QPopupMenu::insertItem</a>().
<p> By default, a custom item can also have an icon set and a keyboard
accelerator. You can reimplement <a href="#fullSpan">fullSpan</a>() to return
TRUE if you want the item to span the entire popup menu width. This
is particularly useful for labels.
<p> If you want the custom item to be treated just as a separator,
reimplement <a href="#isSeparator">isSeparator</a>() to return TRUE.
<p> Note that you can insert pixmaps or bitmaps as items into a popup menu
without needing to create a QCustomMenuItem. However, custom menu
items offer more flexibility, and -- especially important with windows
style -- provide the possibility of drawing the item with a different
color when it is highlighted.
<p> menu/menu.cpp shows a simply example how custom menu items can be used.
<p> Please note: the current implementation of QCustomMenuItem will not recognize
shortcut keys that are from text with ampersands.  Normal accelerators work though.
<p> <img src=qpopmenu-fancy.png>
<p> <p>See also <a href="qmenudata.html">QMenuData</a>, <a href="qpopupmenu.html">QPopupMenu</a> and <a href="misc.html">Miscellaneous Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QCustomMenuItem"></a>QCustomMenuItem::QCustomMenuItem ()
</h3>
Constructs a QCustomMenuItem

<h3 class=fn><a name="~QCustomMenuItem"></a>QCustomMenuItem::~QCustomMenuItem ()<tt> [virtual]</tt>
</h3>
Destroys a QCustomMenuItem

<h3 class=fn>bool <a name="fullSpan"></a>QCustomMenuItem::fullSpan () const<tt> [virtual]</tt>
</h3>
Returns TRUE if this item wants to span the entire popup menu width.
The default is FALSE, meaning that the menu may show an icon and
an accelerator key for this item as well.

<h3 class=fn>bool <a name="isSeparator"></a>QCustomMenuItem::isSeparator () const<tt> [virtual]</tt>
</h3>
Returns TRUE if this item is just a separator; otherwise returns FALSE.

<h3 class=fn>void <a name="paint"></a>QCustomMenuItem::paint ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;cg, bool&nbsp;act, bool&nbsp;enabled, int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )<tt> [pure virtual]</tt>
</h3> 
<p> Paints this item. When this function is invoked, the painter <em>p</em> is
set to the right font and the right foreground color suitable for a
menu item text using color group <em>cg</em>. The item is active if <em>act</em>
is TRUE and enabled if <em>enabled</em> is TRUE. The geometry values <em>x</em>,
<em>y</em>, <em>w</em> and <em>h</em> specify where to draw the item.
<p> Do not draw any background, this has already been done by the popup
menu according to the current GUI style.
<p> 
<h3 class=fn>void <a name="setFont"></a>QCustomMenuItem::setFont ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;font )<tt> [virtual]</tt>
</h3>
Sets the font of the custom menu item to <em>font</em>.
<p> This function is called whenever the font in the popup menu
changes. For menu items that show their own individual font entry,
you want to ignore this.

<h3 class=fn><a href="qsize.html">QSize</a> <a name="sizeHint"></a>QCustomMenuItem::sizeHint ()<tt> [pure virtual]</tt>
</h3> 
<p> Returns the size hint of this item.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2001
<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; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>