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

132 lines
22 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="BPrintJob.html" title="BPrintJob" /><link rel="next" href="BRect.html" title="BRect" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BPrintJob.html" title="BPrintJob"><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="BRect.html" title="BRect"><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="BPrintJob.html">BPrintJob</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BRect.html">BRect</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="BRadioButton"></a>BRadioButton</h2></div></div></div><a id="id1016584" 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></td></tr><tr><td>Mix-in Classes:</td><td></td></tr><tr><td>Declared In:</td><td><code class="filename">interface/RadioButton.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="BRadioButton_Overview.html" title="BRadioButton">Class Overview</a>
<div class="toc"><ul><li><span class="section"><a href="BRadioButton.html#BRadioButton_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BRadioButton.html#BRadioButton_HookFunctions">Hook Functions</a></span></li><li><span class="section"><a href="BRadioButton.html#BRadioButton_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BRadioButton.html#BRadioButton_StaticFunctions">Static Functions</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="BRadioButton_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="BRadioButton_Constructor"></a>BRadioButton()</h4></div></div></div><div class="synopsisgroup">
<code class="constructorsynopsis cpp"><span class="methodname">BRadioButton</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">label</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">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">BRadioButton</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">BRadioButton</code> by passing all arguments
to the <a class="link" href="BControl.html" title="BControl"><code class="classname">BControl</code></a>
constructor without change.
<a class="link" href="BControl.html" title="BControl"><code class="classname">BControl</code></a>
initializes the radio button's <code class="parameter">label</code>
and assigns it a model <code class="parameter">message</code> that identifies the action that should be
taken when the radio button is turned on. When the user turns the button
on, the <code class="classname">BRadioButton</code> posts a copy of the <code class="parameter">message</code> so that it can be
delivered to the target handler.
</p><p>
The <code class="parameter">frame</code>, <code class="parameter">name</code>,
<code class="parameter">resizingMode</code>, and <code class="parameter">flags</code> arguments are the same as those
declared for the <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>
class and are passed without change from <a class="link" href="BControl.html" title="BControl"><code class="classname">BControl</code></a>
to the <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> constructor.
</p><p>
The <code class="classname">BRadioButton</code> draws at the bottom of its frame rectangle beginning at
the left side. It ignores any extra space at the top or on the right.
(However, the user can click anywhere within the <code class="parameter">frame</code> rectangle to turn
on the radio button). When the object is attached to a window, the height
of the rectangle will be adjusted so that there is exactly the right
amount of room to accommodate the label.
</p><p>
See also:
The <a class="link" href="BControl.html" title="BControl"><code class="classname">BControl</code></a> and
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> constructors,
<a class="link" href="BRadioButton.html#BRadioButton_AttachedToWindow" title="AttachedToWindow()"><code class="methodname">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="BRadioButton_Destructor"></a>~BRadioButton()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BRadioButton</span>();</code><p>
Does nothing; a <code class="classname">BRadioButton</code> doesn't need to clean up after itself when
it's 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="BRadioButton_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="BRadioButton_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>
Augments the <a class="link" href="BControl.html" title="BControl"><code class="classname">BControl</code></a> version of
<a class="link" href="BControl.html#BControl_AttachedToWindow" title="AttachedToWindow()"><code class="methodname">AttachedToWindow()</code></a> to set the view and
low colors of the <code class="classname">BRadioButton</code> to the match its parent's view color, and
to resize the radio button vertically to fit the height of the label it
displays. The height of the label depends on the <code class="classname">BRadioButton</code>'s font.
</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="BRadioButton_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 radio button—the circular icon—and its label. The
center of the icon is filled when the <code class="classname">BRadioButton</code>'s value is 1
(<code class="constant">B_CONTROL_ON</code>); it's left empty when the value is 0
(<code class="constant">B_CONTROL_OFF</code>).
</p><p>
See also:
<a class="link" href="BView.html#BView_Draw" title="Draw()"><code class="methodname">BView::Draw()</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="BRadioButton_GetPreferredSize"></a>GetPreferredSize()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">GetPreferredSize</span>(<span class="methodparam"><span class="type">float* </span><span class="parameter">width</span></span>,<br />                              <span class="methodparam"><span class="type">float* </span><span class="parameter">height</span></span>);</code><p>
Calculates the optimal size for the radio button to display the icon and
the label in the current font, and places the result in the variables
that the <code class="parameter">width</code> and <code class="parameter">height</code>
arguments refer to.
<a class="link" href="BView.html#BView_ResizeToPreferred"><code class="methodname">ResizeToPreferred()</code></a>,
defined in the <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> class,
resizes a view's frame rectangle to the
preferred size, keeping its left and top sides constant.
<a class="link" href="BRadioButton.html#BRadioButton_AttachedToWindow" title="AttachedToWindow()"><code class="methodname">AttachedToWindow()</code></a>
automatically resizes a radio button to its preferred
height, but doesn't modify its width.
</p><p>
See also:
<a class="link" href="BView.html#BView_GetPreferredSize" title="GetPreferredSize(), ResizeToPreferred()"><code class="methodname">BView::GetPreferredSize()</code></a>,
<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="BRadioButton_KeyDown"></a>KeyDown()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">KeyDown</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">bytes</span></span>,<br />                     <span class="methodparam"><span class="type">int32 </span><span class="parameter">numBytes</span></span>);</code><p>
Augments the inherited versions of
<a class="link" href="BControl.html#BControl_KeyDown" title="KeyDown()"><code class="methodname">KeyDown()</code></a>
to turn the radio button on
and deliver a message to the target
<a class="link" href="BHandler.html" title="BHandler"><code class="classname">BHandler</code></a>
when the character passed in
<code class="parameter">bytes</code> is <code class="constant">B_SPACE or B_ENTER</code>.
</p><p>
See also:
<a class="link" href="BView.html#BView_KeyDown" title="KeyDown()"><code class="methodname">BView::KeyDown()</code></a>,
<a class="link" href="BRadioButton.html#BRadioButton_SetValue" title="SetValue()"><code class="methodname">SetValue()</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="BRadioButton_MouseDown"></a>MouseDown()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">MouseDown</span>(<span class="methodparam"><span class="type"><a class="link" href="BPoint.html" title="BPoint"><code class="classname">BPoint</code></a> </span><span class="parameter">point</span></span>);</code><p>
Responds to a mouse-down event in the radio button by tracking the cursor
while the user holds the mouse button down. If the cursor is pointing to
the radio button when the user releases the mouse button, this function
turns the button on (and consequently turns all sibling <code class="classname">BRadioButton</code>s
off), calls the <code class="classname">BRadioButton</code>'s
<a class="link" href="BRadioButton.html#BRadioButton_Draw" title="Draw()"><code class="methodname">Draw()</code></a> function, and posts a message that
will be delivered to the target
<a class="link" href="BHandler.html" title="BHandler"><code class="classname">BHandler</code></a>. Unlike a
<a class="link" href="BCheckBox.html" title="BCheckBox"><code class="classname">BCheckBox</code></a>, a
<code class="classname">BRadioButton</code> posts the message—it's
"invoked"—only when it's
turned on, not when it's turned off.
</p><p>
See also:
<a class="link" href="BControl.html#BControl_Invoke" title="Invoke()"><code class="methodname">BControl::Invoke()</code></a>,
<a class="link" href="BInvoker.html#BInvoker_SetTarget" title="SetTarget(), Target(), IsTargetLocal(), Messenger()"><code class="methodname">BInvoker::SetTarget()</code></a>,
<a class="link" href="BRadioButton.html#BRadioButton_SetValue" title="SetValue()"><code class="methodname">SetValue()</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="BRadioButton_SetValue"></a>SetValue()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">SetValue</span>(<span class="methodparam"><span class="type">int32 </span><span class="parameter">value</span></span>);</code><p>
Augments the <a class="link" href="BControl.html" title="BControl"><code class="classname">BControl</code></a>
version of <a class="link" href="BControl.html#BControl_SetValue" title="SetValue(), Value()"><code class="methodname">SetValue()</code></a> to turn all sibling
<code class="classname">BRadioButton</code>s off (set their values to 0) when this
<code class="classname">BRadioButton</code> is
turned on (when the value passed is anything but 0).
</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="BRadioButton_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="BRadioButton_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="BControl.html#BControl_Archive" title="Archive()"><code class="methodname">Archive()</code></a>
and doesn't add anything
specific to the <code class="classname">BRadioButton</code> class to the
<a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a> archive.
</p><p>
<a class="link" href="BArchivable.html#BArchivable_Archive" title="Archive()"><code class="methodname">BArchivable::Archive()</code></a>,
<a class="link" href="BRadioButton.html#BRadioButton_Instantiate" title="Instantiate()"><code class="methodname">Instantiate()</code></a>
static function
</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="BRadioButton_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="BRadioButton_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">BRadioButton</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 data for an archived <code class="classname">BRadioButton</code> object, this
function returns <code class="constant">NULL</code>.
</p><p>
<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="BRadioButton.html#BRadioButton_Archive" title="Archive()"><code class="methodname">Archive()</code></a>
</p></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BPrintJob.html">BPrintJob</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BRect.html">BRect</a> </div><div id="footerB"><div id="footerBL"><a href="BPrintJob.html" title="BPrintJob"><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="BRect.html" title="BRect"><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>