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

61 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="BStringItem.html" title="BStringItem" /><link rel="next" href="BTab.html" title="BTab" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BStringItem.html" title="BStringItem"><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="BTab.html" title="BTab"><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="BStringItem.html">BStringItem</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BTab.html">BTab</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="BStringView"></a>BStringView</h2></div></div></div><a id="id1039223" 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="BView.html" title="BView"><code class="classname">BView</code></a></td></tr><tr><td>Mix-in Classes:</td><td></td></tr><tr><td>Declared In:</td><td><code class="filename">interface/StringView.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="BStringView_Overview.html" title="BStringView">Class Overview</a>
<div class="toc"><ul><li><span class="section"><a href="BStringView.html#BStringView_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BStringView.html#BStringView_HookFunctions">Hook Functions</a></span></li><li><span class="section"><a href="BStringView.html#BStringView_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BStringView.html#BStringView_StaticFunctions">Static Functions</a></span></li><li><span class="section"><a href="BStringView.html#BStringView_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="BStringView_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="BStringView_Constructor"></a>BStringView()</h4></div></div></div><div class="synopsisgroup">
<code class="constructorsynopsis cpp"><span class="methodname">BStringView</span>(<span class="methodparam"><span class="type"><a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> </span><span class="parameter">frame</span></span>,<br />            <span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">name</span></span>,<br />            <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">resizingMode</span><span class="initializer"> = <span class="constant">B_FOLLOW_LEFT</span> | <span class="constant">B_FOLLOW_TOP</span></span></span>,<br />            <span class="methodparam"><span class="type">uint32 </span><span class="parameter">flags</span><span class="initializer"> = <span class="constant">B_WILL_DRAW</span></span></span>);</code>
<code class="constructorsynopsis cpp"><span class="methodname">BStringView</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>
Initializes the <code class="classname">BStringView</code> by assigning it a
<code class="parameter">text</code> string and the system plain font
(<code class="varname">be_plain_font</code>). The <code class="parameter">frame</code>,
<code class="parameter">name</code>, <code class="parameter">resizingMode</code>, and
<code class="parameter">flags</code> arguments are passed unchanged to the
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> constructor.
</p><p>
The <code class="parameter">frame</code> rectangle needs to be large enough to display the entire string
in the current font. The string is drawn at the bottom of the frame
rectangle and, by default, is aligned to the left side. A different
horizontal alignment can be set by calling
<a class="link" href="BStringView.html#BStringView_SetAlignment" title="SetAlignment(), Alignment()"><code class="methodname">SetAlignment()</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="BStringView_Destructor"></a>~BStringView()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BStringView</span>();</code><p>
Frees the text string.
</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="BStringView_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="BStringView_AttachedToWindow"></a>AttachedToWindow()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">AttachedToWindow</span>();</code><p>
Sets the <code class="classname">BStringView</code>'s low color and its background view color to match
the background color of its new parent view.
</p><p>
See also:
<a class="link" href="BView.html#BView_AttachedToWindow" title="AttachedToWindow(), AllAttached()"><code class="methodname">BView::AttachedToWindow()</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="BStringView_Draw"></a>Draw()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">Draw</span>(<span class="methodparam"><span class="type"><a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> </span><span class="parameter">updateRect</span></span>);</code><p>
Draws the string along the bottom of the <code class="classname">BStringView</code>'s frame rectangle in
the current high color.
</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="BStringView_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="BStringView_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
<a class="link" href="BView.html#BView_Archive" title="Archive()"><code class="methodname">Archive()</code></a>, then adds the string and its
alignment to the <a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a> archive.
</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="BStringView_SetAlignment"></a><a id="BStringView_Alignment"></a>
SetAlignment(), Alignment()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">SetAlignment</span>(<span class="methodparam"><span class="type">alignment </span><span class="parameter">flag</span></span>);</code><code class="methodsynopsis cpp"><span class="type">alignment </span><span class="methodname">Alignment</span>() <span class="modifier">const</span>;</code><p>
These functions align the string within the <code class="classname">BStringView</code>'s frame rectangle
and return the current alignment. The alignment flag can be:
</p><table class="variablelist constants"><thead><tr><th>Constant</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_ALIGN_LEFT</code></span></p></td><td><p>The string is aligned at the left side of the frame rectangle.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_ALIGN_RIGHT</code></span></p></td><td><p>The string is aligned at the right side of the frame rectangle.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_ALIGN_CENTER</code></span></p></td><td><p>The string is aligned so that the center of the string
falls midway between the left and right sides of the frame rectangle.</p></td></tr></tbody></table><p>
The default is <code class="constant">B_ALIGN_LEFT</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="BStringView_SetText"></a><a id="BStringView_Text"></a>
SetText(), Text()</h4></div></div></div><code class="methodsynopsis cpp"><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">string</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 string that the <code class="classname">BStringView</code>
draws. <code class="methodname">SetText()</code> frees the previous string and copies string to replace
it. <code class="methodname">Text()</code> returns the null-terminated string.
</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="BStringView_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="BStringView_Instantiate"></a>Instantiate()</h4></div></div></div><p>
See <a class="link" href="BArchivable.html#BArchivable_Instantiate" title="Instantiate()"><code class="methodname">BArchivable::Instantiate()</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="BStringView_ArchivedFields"></a>Archived Fields</h3></div></div></div><p>
The <a class="link" href="BStringView.html#BStringView_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">_text</code></td><td><code class="constant">B_STRING_TYPE</code></td><td>Text displayed in the view (present only if it is not <code class="constant">NULL</code>).</td></tr><tr><td><code class="varname">_align</code></td><td><code class="constant">B_INT32_TYPE</code></td><td>Alignment of text in frame.</td></tr></tbody></table></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BStringItem.html">BStringItem</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BTab.html">BTab</a> </div><div id="footerB"><div id="footerBL"><a href="BStringItem.html" title="BStringItem"><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="BTab.html" title="BTab"><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>