haiku-website/static/legacy-docs/bebook/BStringItem.html

63 lines
16 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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="BStatusBar.html" title="BStatusBar" /><link rel="next" href="BStringView.html" title="BStringView" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BStatusBar.html" title="BStatusBar"><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="BStringView.html" title="BStringView"><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="BStatusBar.html">BStatusBar</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BStringView.html">BStringView</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="BStringItem"></a>BStringItem</h2></div></div></div><a id="id1038336" 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><a class="link" href="BListItem.html" title="BListItem"><code class="classname">BListItem</code></a></td></tr><tr><td>Mix-in Classes:</td><td></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></td></tr></tbody></table></td><td>
<a class="link overview" href="BStringItem_Overview.html" title="BStringItem">Class Overview</a>
<div class="toc"><ul><li><span class="section"><a href="BStringItem.html#BStringItem_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BStringItem.html#BStringItem_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BStringItem.html#BStringItem_StaticFunctions">Static Functions</a></span></li><li><span class="section"><a href="BStringItem.html#BStringItem_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="BStringItem_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="BStringItem_Constructor"></a>BStringItem()</h4></div></div></div><div class="synopsisgroup">
<code class="constructorsynopsis cpp"><span class="methodname">BStringItem</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">text</span></span>,<br />            <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">BStringItem</span>(<span class="methodparam"><span class="type">BMessage* </span><span class="parameter">archive</span></span>);</code>
</div><p>
Initializes the <code class="classname">BStringItem</code> by making a copy of the text string passed as
an argument. This is the string the item will display. The level and
expanded arguments are passed unchanged to the <code class="classname">BListItem</code> constructor; see
that function for an explanation.
</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="BStringItem_Destructor"></a>~BStringItem()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BStringItem</span>();</code><p>
Frees the text the item displays.
</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="BStringItem_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="BStringItem_Archive"></a>Archive()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">status_t </span><span class="methodname">Archive</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>,<br />                         <span class="methodparam"><span class="type">bool </span><span class="parameter">deep</span><span class="initializer"> = <span class="constant">true</span></span></span>) <span class="modifier">const</span>;</code><p>
Calls the inherited version of <code class="methodname">Archive()</code> and stores the
<code class="classname">BStringItem</code> in the
<a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a> archive.
</p><p>
See also:
<a class="link" href="BArchivable.html#BArchivable_Archive" title="Archive()"><code class="methodname">BArchivable::Archive()</code></a>,
<a class="link" href="BStringItem.html#BStringItem_Instantiate" title="Instantiate()"><code class="methodname">Instantiate()</code></a> static 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="BStringItem_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">BRect </span><span class="parameter">frame</span></span>,<br />                      <span class="methodparam"><span class="type">bool </span><span class="parameter">complete</span><span class="initializer"> = <span class="constant">false</span></span></span>);</code><p>
Draws the text string, dimming it if the item is disabled and
highlighting it if the item is selected.
</p><p>
See also:
<a class="link" href="BListItem.html#BListItem_DrawItem" title="DrawItem()"><code class="methodname">BListItem::DrawItem()</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="BStringItem_SetText"></a><a id="BStringItem_Text"></a>
SetText(), Text()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">SetText</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">text</span></span>);</code><code class="methodsynopsis cpp"><span class="modifier">const </span><span class="type">char* </span><span class="methodname">Text</span>() <span class="modifier">const</span>;</code><p>
These functions set and return the text that the <code class="classname">BStringItem</code> draws.
<code class="methodname">SetText()</code> copies the string it's passed. <code class="methodname">Text()</code> returns a pointer to the
string owned by the <code class="classname">BStringItem</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="BStringItem_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>
Overrides the <code class="classname">BListItem</code> version of
<a class="link" href="BListItem.html#BListItem_Update" title="Update()"><code class="methodname">Update()</code></a> to recalculate the width and
height of the <code class="classname">BStringItem</code> and the placement of the text. The width of the
item is based on the width of the owner
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>. The height and text
placement are based on the owner's font. The item must be tall enough to
display the string in the current font.
</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="BStringItem_StaticFunctions"></a>Static 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="BStringItem_Instantiate"></a>Instantiate()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">static </span><span class="type"><a class="link" href="BArchivable.html" title="BArchivable"><code class="classname">BArchivable</code></a>* </span><span class="methodname">Instantiate</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><p>
Returns a new <code class="classname">BStringItem</code> object, allocated by new and created with the
version of the constructor that takes a <a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a> archive. However, if the
archive message doesn't contain archived data for a BStringItem,
Instantiate() returns <code class="constant">NULL</code>.
</p><p>
See also
<a class="link" href="BArchivable.html#BArchivable_Instantiate" title="Instantiate()"><code class="methodname">BArchivable::Instantiate()</code></a>,
<a class="link" href="TheSupportKit_Functions.html#instantiate_object" title="instantiate_object()"><code class="function">instantiate_object()</code></a>,
<a class="link" href="BStringItem.html#BStringItem_Archive" title="Archive()"><code class="methodname">Archive()</code></a>
</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="BStringItem_ArchivedFields"></a>Archived Fields</h3></div></div></div><p>
The <a class="link" href="BStringItem.html#BStringItem_Archive" title="Archive()"><code class="methodname">Archive()</code></a>
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">_label</code></td><td><code class="constant">B_STRING_TYPE</code></td><td>String text (present only if it is not <code class="constant">NULL</code>).</td></tr></tbody></table></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BStatusBar.html">BStatusBar</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BStringView.html">BStringView</a> </div><div id="footerB"><div id="footerBL"><a href="BStatusBar.html" title="BStatusBar"><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="BStringView.html" title="BStringView"><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>