122 lines
23 KiB
HTML
122 lines
23 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="BStringView.html" title="BStringView" /><link rel="next" href="BTabView.html" title="BTabView" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BStringView.html" title="BStringView"><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="BTabView.html" title="BTabView"><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="BStringView.html">BStringView</a> Up: <a href="TheInterfaceKit.html">The Interface Kit</a> Next: <a href="BTabView.html">BTabView</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="BTab"></a>BTab</h2></div></div></div><a id="id1040178" 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="BArchivable.html" title="BArchivable"><code class="classname">BArchivable</code></a></td></tr><tr><td>Mix-in Classes:</td><td>–</td></tr><tr><td>Declared In:</td><td><code class="filename">interface/TabView.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="BTab_Overview.html" title="BTab">Class Overview</a>
|
||
<div class="toc"><ul><li><span class="section"><a href="BTab.html#BTab_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BTab.html#BTab_HookFunctions">Hook Functions</a></span></li><li><span class="section"><a href="BTab.html#BTab_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BTab.html#BTab_StaticFunctions">Static Functions</a></span></li><li><span class="section"><a href="BTab.html#BTab_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="BTab_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="BTab_Constructor"></a>BTab()</h4></div></div></div><div class="synopsisgroup">
|
||
<code class="constructorsynopsis cpp"><span class="methodname">BTab</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">tabView</span><span class="initializer"> = <span class="constant">NULL</span></span></span>);</code>
|
||
|
||
<code class="constructorsynopsis cpp"><span class="methodname">BTab</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">BTab</code> to be enabled, but neither selected nor the current
|
||
focus. The specified <code class="parameter">tabView</code> becomes the tab's target view—when the
|
||
tab is selected, its target view is activated. See the
|
||
<a class="link" href="BTabView.html" title="BTabView"><code class="classname">BTabView</code></a> class for
|
||
further details on how this works.
|
||
</p><p>
|
||
If an <code class="parameter">archive</code> message is specified, the message's contents are used to
|
||
duplicate the archived <code class="classname">BTab</code> object.
|
||
</p><p>
|
||
See also:
|
||
<a class="link" href="BTab.html#BTab_SetView"><code class="methodname">SetView()</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="BTab_Destructor"></a>~BTab()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BTab</span>();</code><p>
|
||
Frees all memory the <code class="classname">BTab</code> allocated. If there is a target view assigned
|
||
to the tab, it is removed from the parent window and deleted.
|
||
</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="BTab_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="BTab_DrawFocusMark"></a><a id="BTab_DrawTab"></a>
|
||
<a id="BTab_DrawLabel"></a>
|
||
DrawFocusMark() , DrawTab() , DrawLabel()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">DrawFocusMark</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">frame</span></span>);</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">DrawTab</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">frame</span></span>,<br /> <span class="methodparam"><span class="type">tab_position </span><span class="parameter">position</span></span>,<br /> <span class="methodparam"><span class="type">bool </span><span class="parameter">full</span><span class="initializer"> = <span class="constant">true</span></span></span>);</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">DrawLabel</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">frame</span></span>);</code><p>
|
||
These three functions can be implemented by your <code class="classname">BTab</code>-derived class to
|
||
create a new visual appearance for your application's tabs. The owner is
|
||
the <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> in which your tab is being drawn, and the frame is the
|
||
rectangle in which the tab is to be drawn.
|
||
</p><p>
|
||
The <code class="methodname">DrawFocusMark()</code> function draws the mark indicating that the <code class="classname">BTab</code>
|
||
object is in focus. By default, this consists of a line in the keyboard
|
||
navigation color, drawn across the bottom of the tab's frame rectangle.
|
||
</p><p>
|
||
<code class="methodname">DrawTab()</code> is called to draw the tab. It draws the tab's title by calling
|
||
<code class="methodname">DrawLabel()</code>, then renders the lines to create the tab itself. The
|
||
position of the tab may affect how the tab is rendered—for example,
|
||
if the tab is frontmost, it may have a different appearance than the
|
||
other tabs.
|
||
</p><p>
|
||
If <code class="parameter">full</code> is <code class="constant">true</code>, the complete tab is drawn inside the frame rectangle. If
|
||
<code class="parameter">full</code> is <code class="constant">false</code>, the right side of the tab is being obscured by the tab to
|
||
its left, so the right edge should be eliminated or truncated as
|
||
necessary.
|
||
</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="BTab_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="BTab_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="BArchivable.html#BArchivable_Archive" title="Archive()"><code class="methodname">Archive()</code></a> and stores the
|
||
<code class="classname">BTab</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="BTab.html#BTab_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="BTab_IsEnabled"></a><a id="BTab_SetEnabled"></a>
|
||
IsEnabled(), SetEnabled()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsEnabled</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><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><p>
|
||
The <code class="methodname">IsEnabled()</code> function returns the <code class="constant">true</code> if the tab is enabled (and can
|
||
therefore be selected by the user) or <code class="constant">false</code> if the tab is disabled.
|
||
</p><p>
|
||
<code class="methodname">SetEnabled()</code> is called to enable or disable the tab. Pass a value of <code class="constant">true</code>
|
||
to enable the tab, or <code class="constant">false</code> to disable it.
|
||
</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="BTab_IsSelected"></a><a id="BTab_Deselect"></a>
|
||
<a id="BTab_Select"></a>
|
||
IsSelected() , Deselect() , Select()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsSelected</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">Deselect</span>();</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">Select</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>);</code><p>
|
||
The <code class="methodname">IsSelected()</code> function returns true if the tab is currently selected,
|
||
<code class="constant">false</code> if it's not.
|
||
</p><p>
|
||
<code class="methodname">Deselect()</code> is called to deselect the tab. This removes the tab's target
|
||
view from the owner window by calling the target view's
|
||
<a class="link" href="BView.html#BView_RemoveSelf" title="RemoveSelf()"><code class="methodname">RemoveSelf()</code></a>
|
||
function.
|
||
</p><p>
|
||
<code class="methodname">Select()</code> is called to select the tab. This also adds the tab's target
|
||
view to the specified owner view. This is called after the previously
|
||
selected tab's <code class="methodname">Deselect()</code> function is called.
|
||
</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="BTab_Label"></a><a id="BTab_SetLabel"></a>
|
||
Label(), SetLabel()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">const </span><span class="type">char* </span><span class="methodname">Label</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">SetLabel</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">label</span></span>);</code><p>
|
||
The <code class="methodname">Label()</code> function returns the tab's label. The label is the same as
|
||
the target view's name.
|
||
</p><p>
|
||
<code class="methodname">SetLabel()</code> is called to set the tab's label. This also changes the target
|
||
view's name to match the tab's label, if a target view exists.
|
||
</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 the tab doesn't have a target view, <code class="methodname">SetLabel()</code> does nothing. Make
|
||
sure a target view has been set (by calling
|
||
<a class="link" href="BTab.html#BTab_SetView"><code class="methodname">SetView()</code></a>,
|
||
<a class="link" href="BTabView.html#BTabView_AddTab" title="AddTab(), RemoveTab()"><code class="methodname">BTabView::AddTab()</code></a>
|
||
with a valid target view argument, or in the <code class="classname">BTab</code> constructor) before you
|
||
call <code class="methodname">SetLabel()</code>.</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="BTab_IsFocus"></a><a id="BTab_MakeFocus"></a>
|
||
IsFocus(), MakeFocus()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsFocus</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">MakeFocus</span>(<span class="methodparam"><span class="type">bool </span><span class="parameter">inFocus</span><span class="initializer"> = <span class="constant">true</span></span></span>);</code><p>
|
||
<code class="methodname">IsFocus()</code> returns <code class="constant">true</code> if the tab is the current focus or <code class="constant">false</code> if it is
|
||
not.
|
||
</p><p>
|
||
<code class="methodname">MakeFocus()</code> specifies whether or not the tab is the current focus. Pass
|
||
<code class="constant">true</code> to make the tab the current focus, or <code class="constant">false</code> if you don't want it to
|
||
be the focus.
|
||
</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="BTab_View"></a><a id="BTab_SetView"></a>
|
||
View(), SetView()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type"><a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>* </span><span class="methodname">View</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">SetView</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">view</span></span>);</code><p>
|
||
The <code class="methodname">View()</code> function returns the tab's target view.
|
||
</p><p>
|
||
<code class="methodname">SetView()</code> is called to set the tab's target view to the specified <code class="parameter">view</code>.
|
||
</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="BTab_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="BTab_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">BTab</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 message doesn't contain archived data for a
|
||
<code class="classname">BTab</code>, <code class="methodname">Instantiate()</code> 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="BTab.html#BTab_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="BTab_ArchivedFields"></a>Archived Fields</h3></div></div></div><p>
|
||
The <a class="link" href="BTab.html#BTab_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">_disable</code></td><td><code class="constant">B_BOOL_TYPE</code></td><td><code class="constant">true</code> if the tab is disabled. Not present if the
|
||
tab is enabled.</td></tr></tbody></table></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BStringView.html">BStringView</a> Up: <a href="TheInterfaceKit.html">The Interface Kit</a> Next: <a href="BTabView.html">BTabView</a> </div><div id="footerB"><div id="footerBL"><a href="BStringView.html" title="BStringView"><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="BTabView.html" title="BTabView"><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>
|