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

102 lines
21 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.

<?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="BPicture.html" title="BPicture" /><link rel="next" href="BPoint.html" title="BPoint" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BPicture.html" title="BPicture"><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="BPoint.html" title="BPoint"><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="BPicture.html">BPicture</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BPoint.html">BPoint</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="BPictureButton"></a>BPictureButton</h2></div></div></div><a id="id1010472" 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="BControl.html" title="BControl"><code class="classname">BControl</code></a> &gt;
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> &gt;
<a class="link" href="BHandler.html" title="BHandler"><code class="classname">BHandler</code></a> &gt;
<a class="link" href="BArchivable.html" title="BArchivable"><code class="classname">BArchivable</code></a></td></tr><tr><td>Mix-in Classes:</td><td><a class="link" href="BInvoker.html" title="BInvoker"><code class="classname">BInvoker</code></a></td></tr><tr><td>Declared In:</td><td><code class="filename">interface/PictureButton.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="BPictureButton_Overview.html" title="BPictureButton">Class Overview</a>
<div class="toc"><ul><li><span class="section"><a href="BPictureButton.html#BPictureButton_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BPictureButton.html#BPictureButton_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BPictureButton.html#BPictureButton_StaticFunctions">Static Functions</a></span></li><li><span class="section"><a href="BPictureButton.html#BPictureButton_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="BPictureButton_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="BPictureButton_Constructor"></a>BPictureButton()</h4></div></div></div><div class="synopsisgroup">
<code class="constructorsynopsis cpp"><span class="methodname">BPictureButton</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="type"><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a>* </span><span class="parameter">off</span></span>,<br />               <span class="methodparam"><span class="type"><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a>* </span><span class="parameter">on</span></span>,<br />               <span class="methodparam"><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="parameter">message</span></span>,<br />               <span class="methodparam"><span class="type">uint32 </span><span class="parameter">behavior</span><span class="initializer"> = <span class="constant">B_ONE_STATE_BUTTON</span></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 class="constant">B_NAVIGABLE</span></span></span>);</code>
<code class="constructorsynopsis cpp"><span class="methodname">BPictureButton</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>
Creates a new <code class="classname">BPictureButton</code>. The <code class="parameter">off</code> and an
<code class="parameter">on</code> images correspond to the
object's <code class="constant">B_CONTROL_OFF</code> and <code class="constant">B_CONTROL_ON</code> values; the <code class="parameter">behavior</code> argument
sets the object to be a one-state (<code class="constant">B_ONE_STATE_BUTTON</code>) or two-state
(<code class="constant">B_TWO_STATE_BUTTON</code>) control, as explained in the class overview. The
other arguments are inherited from the
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> and
<a class="link" href="BControl.html" title="BControl"><code class="classname">BControl</code></a> constructors.
The object's initial value is <code class="constant">B_CONTROL_OFF</code>.
</p><p>
If the <code class="classname">BPictureButton</code> can be disabled, it needs additional "disabled"
images, as set through
<a class="link" href="BPictureButton.html#BPictureButton_SetDisabledOff"><code class="methodname">SetDisabledOff()</code></a>
and <a class="link" href="BPictureButton.html#BPictureButton_SetDisabledOn"><code class="methodname">SetDisabledOn()</code></a>.
</p><p>
The <code class="classname">BPictureButton</code> copies all
<a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a>s that are passed to it. It's the
caller's responsibility to free the <a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a> objects that are passed as
arguments.
</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="BPictureButton_Destructor"></a>~BPictureButton()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BPictureButton</span>();</code><p>
Deletes the object and its data.
</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="BPictureButton_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="BPictureButton_Archive"></a>Archive()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </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>
Stores the <code class="classname">BPictureButton</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="BPictureButton.html#BPictureButton_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="BPictureButton_SetBehavior"></a><a id="BPictureButton_Behavior"></a>
SetBehavior(), Behavior()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">SetBehavior</span>(<span class="methodparam"><span class="type">uint32 </span><span class="parameter">behavior</span></span>);</code><code class="methodsynopsis cpp"><span class="type">uint32 </span><span class="methodname">Behavior</span>() <span class="modifier">const</span>;</code><p>
These functions set and return whether the <code class="classname">BPictureButton</code> is a one-state
(<code class="constant">B_ONE_STATE_BUTTON</code>) or a two-state (<code class="constant">B_TWO_STATE_BUTTON</code>) control. A
one-state object acts like a normal button: It's on while the user is
pressing it, and off otherwise. A two-state object switches to the
opposite state each time the user presses and release the button.
</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="BPictureButton_SetEnabledOff"></a><a id="BPictureButton_SetEnabledOn"></a>
<a id="BPictureButton_SetDisabledOff"></a>
<a id="BPictureButton_SetDisabledOn"></a>
<a id="BPictureButton_EnabledOff"></a>
<a id="BPictureButton_EnabledOn"></a>
<a id="BPictureButton_DisabledOff"></a>
<a id="BPictureButton_DisabledOn"></a>
SetEnabledOff(), SetEnabledOn(), SetDisabledOff(), SetDisabledOn(),
EnabledOff(), EnabledOn(), DisabledOff(), DisabledOn()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">SetEnabledOff</span>(<span class="methodparam"><span class="type"><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a>* </span><span class="parameter">picture</span></span>);</code><code class="methodsynopsis cpp"><span class="type"><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a>* </span><span class="methodname">EnabledOff</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">SetEnabledOn</span>(<span class="methodparam"><span class="type"><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a>* </span><span class="parameter">picture</span></span>);</code><code class="methodsynopsis cpp"><span class="type"><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a>* </span><span class="methodname">EnabledOn</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">SetDisabledOff</span>(<span class="methodparam"><span class="type"><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a>* </span><span class="parameter">picture</span></span>);</code><code class="methodsynopsis cpp"><span class="type"><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a>* </span><span class="methodname">DisabledOff</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">SetDisabledOn</span>(<span class="methodparam"><span class="type"><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a>* </span><span class="parameter">picture</span></span>);</code><code class="methodsynopsis cpp"><span class="type"><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a>* </span><span class="methodname">DisabledOn</span>() <span class="modifier">const</span>;</code><p>
These pairs of functions set and return one of the four images the
<code class="classname">BPictureButton</code> displays: enabled-and-on, enabled-and-off,
disabled-and-on, and disabled-and-off, respectively. If this is a
one-state object, the disabled-and-on image needn't be set since a
disabled one-state control can never be on.
</p><p>
The <a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a>-retrieving
functions return <code class="constant">NULL</code> if the requested image
hasn't been set.
</p><p>
The <code class="classname">BPictureButton</code> copies all
<a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a> that are passed to it. It's the
caller's responsibility to free the
<a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a> objects that are passed as
arguments.
</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="BPictureButton_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="BPictureButton_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">BPictureButton</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 data for a <code class="classname">BPictureButton</code> object, this
function 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="BPictureButton.html#BPictureButton_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="BPictureButton_ArchivedFields"></a>Archived Fields</h3></div></div></div><p>
The <a class="link" href="BPictureButton.html#BPictureButton_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">_e_on</code> (deep copy only)</td><td><code class="constant">B_MESSAGE_TYPE</code></td><td><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a> displayed when control is
enabled and on.</td></tr><tr><td><code class="varname">_e_off</code> (deep copy only)</td><td><code class="constant">B_MESSAGE_TYPE</code></td><td><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a> displayed when control is
enabled and off.</td></tr><tr><td><code class="varname">_d_on</code> (deep copy only)</td><td><code class="constant">B_MESSAGE_TYPE</code></td><td><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a> displayed when control is
disabled and on.</td></tr><tr><td><code class="varname">_d_off</code> (deep copy only)</td><td><code class="constant">B_MESSAGE_TYPE</code></td><td><a class="link" href="BPicture.html" title="BPicture"><code class="classname">BPicture</code></a> displayed when control is
disabled and off.</td></tr><tr><td><code class="varname">_behave</code></td><td><code class="constant">B_INT32_TYPE</code></td><td><code class="classname">BPictureButton</code> behavior either <code class="constant">B_ONE_STATE_BUTTON</code>
or <code class="constant">B_TWO_STATE_BUTTON</code></td></tr></tbody></table></div><p>
See also:
<a class="link" href="BArchivable.html#BArchivable_Archive" title="Archive()"><code class="methodname">BArchivable::Archive()</code></a>
</p></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BPicture.html">BPicture</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BPoint.html">BPoint</a> </div><div id="footerB"><div id="footerBL"><a href="BPicture.html" title="BPicture"><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="BPoint.html" title="BPoint"><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>