117 lines
21 KiB
HTML
117 lines
21 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - Classes And Methods - The Interface Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
|
||
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
|
||
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheInterfaceKit.html" title="The Interface Kit" /><link rel="prev" href="BFont.html" title="BFont" /><link rel="next" href="BListView.html" title="BListView" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BFont.html" title="BFont"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheInterfaceKit.html" title="The Interface Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BListView.html" title="BListView"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - Classes And Methods - The Interface Kit</div></div><div id="headerB">Prev: <a href="BFont.html">BFont</a> Up: <a href="TheInterfaceKit.html">The Interface Kit</a> Next: <a href="BListView.html">BListView</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem"></a>BListItem</h2></div></div></div><a id="id987664" class="indexterm"></a><div class="classheader"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td><table width="100%" border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Derived From:</td><td>–</td></tr><tr><td>Mix-in Classes:</td><td><a class="link" href="BArchivable.html" title="BArchivable"><code class="classname">BArchivable</code></a></td></tr><tr><td>Declared In:</td><td><code class="filename">interface/ListItem.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libbe.so</code></td></tr><tr><td>Allocation:</td><td>Constructor only</td></tr></tbody></table></td><td>
|
||
<a class="link overview" href="BListItem_Overview.html" title="BListItem">Class Overview</a>
|
||
<div class="toc"><ul><li><span class="section"><a href="BListItem.html#BListItem_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BListItem.html#BListItem_HookFunctions">Hook Functions</a></span></li><li><span class="section"><a href="BListItem.html#BListItem_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BListItem.html#BListItem_ArchivedFields">Archived Fields</a></span></li></ul></div>
|
||
</td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem_ConstructorDestructor"></a>Constructor and Destructor</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem_Constructor"></a>BListItem()</h4></div></div></div><div class="synopsisgroup">
|
||
<code class="constructorsynopsis cpp"><span class="methodname">BListItem</span>(<span class="methodparam"><span class="type">uint32 </span><span class="parameter">level</span><span class="initializer"> = 0</span></span>,<br /> <span class="methodparam"><span class="type">bool </span><span class="parameter">expanded</span><span class="initializer"> = <span class="constant">true</span></span></span>);</code>
|
||
|
||
<code class="constructorsynopsis cpp"><span class="methodname">BListItem</span>(<span class="methodparam"><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="parameter">archive</span></span>);</code>
|
||
</div><p>
|
||
The constructors create a new <code class="classname">BListItem</code> object. The level and expanded
|
||
arguments are only used if the item is added to a
|
||
<a class="link" href="BOutlineListView.html" title="BOutlineListView"><code class="classname">BOutlineListView</code></a>
|
||
object; see
|
||
<a class="link" href="BOutlineListView.html#BOutlineListView_AddItem" title="AddItem(), AddUnder()"><code class="methodname">BOutlineListView::AddItem()</code></a>
|
||
for more information.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem_Destructor"></a>~BListItem()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="methodname">~BListItem</span>();</code><p>
|
||
The destructor is empty.
|
||
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem_HookFunctions"></a>Hook Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem_DrawItem"></a>DrawItem()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">DrawItem</span>(<span class="methodparam"><span class="type"><a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>* </span><span class="parameter">owner</span></span>,<br /> <span class="methodparam"><span class="type"><a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> </span><span class="parameter">itemRect</span></span>,<br /> <span class="methodparam"><span class="type">bool </span><span class="parameter">drawEverything</span><span class="initializer"> = <span class="constant">false</span></span></span>) <span class="modifier">= 0</span>;</code><p>
|
||
Hook function that's invoked when the item's owner (a
|
||
<a class="link" href="BListView.html" title="BListView"><code class="classname">BListView</code></a> object)
|
||
needs to draw this item. <code class="parameter">itemRect</code> is the area within the owner to which
|
||
the item's drawing is clipped. If <code class="parameter">drawEverything</code> is
|
||
<code class="constant">true</code>, this function
|
||
should touch every pixel in <code class="parameter">itemRect</code>; if it's
|
||
<code class="constant">false</code>, the function can
|
||
assume that the background color for the item is already painted.
|
||
<code class="methodname">DrawItem()</code> should be implemented to visually reflect the state of the
|
||
item, highlighting it if it's selected, dimming it if it's disabled, and
|
||
so on.
|
||
</p><p>
|
||
The owner view provides the drawing environment for this item. All
|
||
drawing instructions should be invoked on owner.
|
||
See
|
||
"<a class="xref" href="BListItem_Overview.html#BListItem_Overview_Custom" title="Creating a Custom List Item">Creating a Custom List Item</a>"
|
||
for an example <code class="methodname">DrawItem()</code> function.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem_Update"></a>Update()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">Update</span>(<span class="methodparam"><span class="type"><a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>* </span><span class="parameter">owner</span></span>,<br /> <span class="methodparam"><span class="modifier">const </span><span class="type"><a class="link" href="BFont.html" title="BFont"><code class="classname">BFont</code></a>* </span><span class="parameter">font</span></span>);</code><p>
|
||
Hook function that's called whenever the item's <code class="parameter">owner</code> changes in a way
|
||
that could affect the appearance of this item. It's always called when
|
||
the item is added to a list view.
|
||
</p><p>
|
||
The default implementation sets the item's width to that of the owner,
|
||
and sets its height so it will accommodate <code class="parameter">font</code> (the owner's current
|
||
<a class="link" href="BFont.html" title="BFont"><code class="classname">BFont</code></a> setting).
|
||
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem_MemberFunctions"></a>Member Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem_OutlineLevel"></a>OutlineLevel()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">uint32 </span><span class="methodname">OutlineLevel</span>() <span class="modifier">const</span>;</code><p>
|
||
Returns the outline level of the item; this is only meaningful if the
|
||
item is in a <a class="link" href="BOutlineListView.html" title="BOutlineListView"><code class="classname">BOutlineListView</code></a>.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem_Select"></a><a id="BListItem_Deselect"></a>
|
||
<a id="BListItem_IsSelected"></a>
|
||
Select(), Deselect(), IsSelected()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">Select</span>();</code><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">Deselect</span>();</code><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsSelected</span>() <span class="modifier">const</span>;</code><p>
|
||
<code class="methodname">Select()</code> and <code class="methodname">Deselect()</code>
|
||
set the item's selected state; <code class="methodname">IsSelected()</code>
|
||
returns the state. The setting functions don't automatically update the
|
||
item's display: After calling <code class="methodname">Select()</code> or
|
||
<code class="methodname">Deselect()</code>, you must tell the
|
||
owner to redrawn this item (see
|
||
<a class="link" href="BListView.html#BListView_InvalidateItem" title="InvalidateItem()"><code class="methodname">BListView::InvalidateItem()</code></a>).
|
||
</p><p>
|
||
Also, <code class="methodname">Select()</code> doesn't deselect the current selection. If this item is
|
||
part of a single-selection list view, you have to deselect the current
|
||
selection yourself.
|
||
</p><div class="admonition note"><div class="title">Note</div><div class="graphic"><img class="icon" alt="Note" width="32" src="./images/admonitions/Info_32.png" /><div class="text"><p>If possible, you should use <a class="link" href="BListView.html" title="BListView"><code class="classname">BListView</code></a>'s versions of these functions
|
||
(see
|
||
<a class="link" href="BListView.html#BListView_Select" title="Select()"><code class="methodname">BListView::Select()</code></a>.
|
||
They update the view and manage the selection for you.</p></div></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem_SetEnabled"></a><a id="BListItem_IsEnabled"></a>
|
||
SetEnabled(), IsEnabled()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">SetEnabled</span>(<span class="methodparam"><span class="type">bool </span><span class="parameter">enabled</span></span>);</code><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsEnabled</span>() <span class="modifier">const</span>;</code><p>
|
||
<code class="methodname">SetEnabled()</code> sets the list item's enabled state; <code class="methodname">IsEnabled()</code> returns the
|
||
state. A disabled item can't be selected by the user or by
|
||
<a class="link" href="BListView.html#BListView_Select" title="Select()"><code class="methodname">BListView::Select()</code></a>
|
||
, but it can be selected through
|
||
<a class="link" href="BListItem.html#BListItem_Select" title="Select(), Deselect(), IsSelected()"><code class="methodname">BListItem::Select()</code></a>.
|
||
If an item is already selected, <code class="methodname">SetEnabled</code>(<code class="constant">false</code>)
|
||
doesn't deselect it.
|
||
</p><p>
|
||
After calling <code class="methodname">SetEnabled()</code>, you must tell the owner list view to redraw
|
||
the item (see
|
||
<a class="link" href="BListView.html#BListView_InvalidateItem" title="InvalidateItem()"><code class="methodname">BListView::InvalidateItem()</code></a>).
|
||
</p><p>
|
||
Note that <a class="link" href="BListView.html" title="BListView"><code class="classname">BListView</code></a>
|
||
doesn't provide smart versions of these functions (as it does for
|
||
<code class="methodname">Select()</code>).
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem_SetExpanded"></a><a id="BListItem_IsExpanded"></a>
|
||
SetExpanded(), IsExpanded()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">SetExpanded</span>(<span class="methodparam"><span class="type">bool </span><span class="parameter">expanded</span></span>);</code><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsExpanded</span>() <span class="modifier">const</span>;</code><p>
|
||
These functions set and return the item's expanded state. This is only
|
||
meaningful if the item is part of a
|
||
<a class="link" href="BOutlineListView.html" title="BOutlineListView"><code class="classname">BOutlineListView</code></a>.
|
||
The item is not automatically redrawn; you must tell the
|
||
<a class="link" href="BOutlineListView.html" title="BOutlineListView"><code class="classname">BOutlineListView</code></a>
|
||
to redraw the item (and its sublist) through
|
||
<a class="link" href="BListView.html#BListView_InvalidateItem" title="InvalidateItem()"><code class="methodname">BListView::InvalidateItem()</code></a>.
|
||
</p><div class="admonition note"><div class="title">Note</div><div class="graphic"><img class="icon" alt="Note" width="32" src="./images/admonitions/Info_32.png" /><div class="text"><p>If possible, you should use
|
||
<a class="link" href="BOutlineListView.html" title="BOutlineListView"><code class="classname">BOutlineListView</code></a>'s
|
||
<a class="link" href="BOutlineListView.html#BOutlineListView_Expand"><code class="methodname">Expand()</code></a> and
|
||
<a class="link" href="BOutlineListView.html#BOutlineListView_Collapse" title="Collapse(), Expand()"><code class="methodname">Collapse()</code></a>
|
||
functions instead of <code class="methodname">SetExpanded()</code>. The
|
||
<a class="link" href="BOutlineListView.html" title="BOutlineListView"><code class="classname">BOutlineListView</code></a>
|
||
functions redraw the affected part of the list for you.</p></div></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem_SetHeight"></a><a id="BListItem_Width"></a>
|
||
<a id="BListItem_Height"></a>
|
||
<a id="BListItem_SetWidth"></a>
|
||
SetHeight(), SetWidth(), Height(), Width()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">SetHeight</span>(<span class="methodparam"><span class="type">float </span><span class="parameter">height</span></span>);</code><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">SetWidth</span>(<span class="methodparam"><span class="type">float </span><span class="parameter">height</span></span>);</code><code class="methodsynopsis cpp"><span class="type">float </span><span class="methodname">Height</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">float </span><span class="methodname">Width</span>() <span class="modifier">const</span>;</code><p>
|
||
These functions set and return the width and height of the item. The
|
||
item's dimensions are adjusted when
|
||
<a class="link" href="BListItem.html#BListItem_Update" title="Update()"><code class="methodname">Update()</code></a>
|
||
is called.
|
||
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BListItem_ArchivedFields"></a>Archived Fields</h3></div></div></div><p>
|
||
The <code class="methodname">Archive()</code> function adds the following fields to its
|
||
<a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a> argument:
|
||
</p><div class="informaltable"><table border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Field</th><th>Type code</th><th>Description</th></tr></thead><tbody><tr><td><code class="varname">_sel</code></td><td><code class="constant">B_BOOL_TYPE</code></td><td><code class="constant">true</code> if the item is selectable.</td></tr><tr><td><code class="varname">_disable</code></td><td><code class="constant">B_BOOL_TYPE</code></td><td><code class="constant">true</code> if the item is disabled.</td></tr><tr><td><code class="varname">_li_expanded</code></td><td><code class="constant">B_BOOL_TYPE</code></td><td><code class="constant">true</code> if the item is expanded.</td></tr><tr><td><code class="varname">_li_outline_level</code></td><td><code class="constant">B_INT32_TYPE</code></td><td>The outline level of the item.</td></tr></tbody></table></div><p>
|
||
Some of these fields may not be present if the setting they represent
|
||
isn't used, or is the default value. For example, if the item is not
|
||
selectable, the <code class="varname">_sel</code> field won't be found in the archive.
|
||
</p></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BFont.html">BFont</a> Up: <a href="TheInterfaceKit.html">The Interface Kit</a> Next: <a href="BListView.html">BListView</a> </div><div id="footerB"><div id="footerBL"><a href="BFont.html" title="BFont"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheInterfaceKit.html" title="The Interface Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BListView.html" title="BListView"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
|
||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
|
||
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>
|