gtk3/docs/reference/gtk/html/GtkRadioButton.html
2022-06-01 16:13:05 +01:00

731 lines
44 KiB
HTML
Raw 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.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GtkRadioButton: GTK+ 3 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GTK+ 3 Reference Manual">
<link rel="up" href="ButtonWidgets.html" title="Buttons and Toggles">
<link rel="prev" href="GtkCheckButton.html" title="GtkCheckButton">
<link rel="next" href="GtkToggleButton.html" title="GtkToggleButton">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
<a href="#GtkRadioButton.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
<a href="#GtkRadioButton.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
<a href="#GtkRadioButton.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span><span id="nav_properties">  <span class="dim">|</span> 
<a href="#GtkRadioButton.properties" class="shortcut">Properties</a></span><span id="nav_signals">  <span class="dim">|</span> 
<a href="#GtkRadioButton.signals" class="shortcut">Signals</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ButtonWidgets.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="GtkCheckButton.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="GtkToggleButton.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GtkRadioButton"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GtkRadioButton.top_of_page"></a>GtkRadioButton</span></h2>
<p>GtkRadioButton — A choice from multiple check buttons</p>
</td>
<td class="gallery_image" valign="top" align="right"><img src="radio-group.png"></td>
</tr></table></div>
<div class="refsect1">
<a name="GtkRadioButton.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="GtkRadioButton.html#gtk-radio-button-new" title="gtk_radio_button_new ()">gtk_radio_button_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="GtkRadioButton.html#gtk-radio-button-new-from-widget" title="gtk_radio_button_new_from_widget ()">gtk_radio_button_new_from_widget</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="GtkRadioButton.html#gtk-radio-button-new-with-label" title="gtk_radio_button_new_with_label ()">gtk_radio_button_new_with_label</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="GtkRadioButton.html#gtk-radio-button-new-with-label-from-widget" title="gtk_radio_button_new_with_label_from_widget ()">gtk_radio_button_new_with_label_from_widget</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="GtkRadioButton.html#gtk-radio-button-new-with-mnemonic" title="gtk_radio_button_new_with_mnemonic ()">gtk_radio_button_new_with_mnemonic</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="GtkRadioButton.html#gtk-radio-button-new-with-mnemonic-from-widget" title="gtk_radio_button_new_with_mnemonic_from_widget ()">gtk_radio_button_new_with_mnemonic_from_widget</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GtkRadioButton.html#gtk-radio-button-set-group" title="gtk_radio_button_set_group ()">gtk_radio_button_set_group</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">GSList</span> *
</td>
<td class="function_name">
<a class="link" href="GtkRadioButton.html#gtk-radio-button-get-group" title="gtk_radio_button_get_group ()">gtk_radio_button_get_group</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GtkRadioButton.html#gtk-radio-button-join-group" title="gtk_radio_button_join_group ()">gtk_radio_button_join_group</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GtkRadioButton.properties"></a><h2>Properties</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="properties_type">
<col width="300px" class="properties_name">
<col width="200px" class="properties_flags">
</colgroup>
<tbody><tr>
<td class="property_type">
<a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> *</td>
<td class="property_name"><a class="link" href="GtkRadioButton.html#GtkRadioButton--group" title="The “group” property">group</a></td>
<td class="property_flags">Write</td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GtkRadioButton.signals"></a><h2>Signals</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="signal_proto_type">
<col width="300px" class="signal_proto_name">
<col width="200px" class="signal_proto_flags">
</colgroup>
<tbody><tr>
<td class="signal_type"><span class="returnvalue">void</span></td>
<td class="signal_name"><a class="link" href="GtkRadioButton.html#GtkRadioButton-group-changed" title="The “group-changed” signal">group-changed</a></td>
<td class="signal_flags">Run First</td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GtkRadioButton.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="other_proto_type">
<col class="other_proto_name">
</colgroup>
<tbody><tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="GtkRadioButton.html#GtkRadioButton-struct" title="struct GtkRadioButton">GtkRadioButton</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GtkRadioButton.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen"> GObject
<span class="lineart">╰──</span> GInitiallyUnowned
<span class="lineart">╰──</span> <a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>
<span class="lineart">╰──</span> <a class="link" href="GtkContainer.html" title="GtkContainer">GtkContainer</a>
<span class="lineart">╰──</span> <a class="link" href="GtkBin.html" title="GtkBin">GtkBin</a>
<span class="lineart">╰──</span> <a class="link" href="GtkButton.html" title="GtkButton">GtkButton</a>
<span class="lineart">╰──</span> <a class="link" href="GtkToggleButton.html" title="GtkToggleButton">GtkToggleButton</a>
<span class="lineart">╰──</span> <a class="link" href="GtkCheckButton.html" title="GtkCheckButton">GtkCheckButton</a>
<span class="lineart">╰──</span> GtkRadioButton
</pre>
</div>
<div class="refsect1">
<a name="GtkRadioButton.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GtkRadioButton implements
AtkImplementorIface, <a class="link" href="GtkBuildable.html" title="GtkBuildable">GtkBuildable</a>, <a class="link" href="GtkActionable.html" title="GtkActionable">GtkActionable</a> and <a class="link" href="GtkActivatable.html" title="GtkActivatable">GtkActivatable</a>.</p>
</div>
<div class="refsect1">
<a name="GtkRadioButton.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gtk/gtk.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="GtkRadioButton.description"></a><h2>Description</h2>
<p>A single radio button performs the same basic function as a <a class="link" href="GtkCheckButton.html" title="GtkCheckButton"><span class="type">GtkCheckButton</span></a>,
as its position in the object hierarchy reflects. It is only when multiple
radio buttons are grouped together that they become a different user
interface component in their own right.</p>
<p>Every radio button is a member of some group of radio buttons. When one is
selected, all other radio buttons in the same group are deselected. A
<a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> is one way of giving the user a choice from many options.</p>
<p>Radio button widgets are created with <a class="link" href="GtkRadioButton.html#gtk-radio-button-new" title="gtk_radio_button_new ()"><code class="function">gtk_radio_button_new()</code></a>, passing <code class="literal">NULL</code>
as the argument if this is the first radio button in a group. In subsequent
calls, the group you wish to add this button to should be passed as an
argument. Optionally, <a class="link" href="GtkRadioButton.html#gtk-radio-button-new-with-label" title="gtk_radio_button_new_with_label ()"><code class="function">gtk_radio_button_new_with_label()</code></a> can be used if you
want a text label on the radio button.</p>
<p>Alternatively, when adding widgets to an existing group of radio buttons,
use <a class="link" href="GtkRadioButton.html#gtk-radio-button-new-from-widget" title="gtk_radio_button_new_from_widget ()"><code class="function">gtk_radio_button_new_from_widget()</code></a> with a <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> that already
has a group assigned to it. The convenience function
<a class="link" href="GtkRadioButton.html#gtk-radio-button-new-with-label-from-widget" title="gtk_radio_button_new_with_label_from_widget ()"><code class="function">gtk_radio_button_new_with_label_from_widget()</code></a> is also provided.</p>
<p>To retrieve the group a <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> is assigned to, use
<a class="link" href="GtkRadioButton.html#gtk-radio-button-get-group" title="gtk_radio_button_get_group ()"><code class="function">gtk_radio_button_get_group()</code></a>.</p>
<p>To remove a <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> from one group and make it part of a new one,
use <a class="link" href="GtkRadioButton.html#gtk-radio-button-set-group" title="gtk_radio_button_set_group ()"><code class="function">gtk_radio_button_set_group()</code></a>.</p>
<p>The group list does not need to be freed, as each <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> will remove
itself and its list item when it is destroyed.</p>
<div class="refsect2">
<a name="id-1.3.9.4.10.9"></a><h3>CSS nodes</h3>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="n">radiobutton</span><span class="w"></span>
<span class="err">├──</span><span class="w"> </span><span class="n">radio</span><span class="w"></span>
<span class="err">╰──</span><span class="w"> </span><span class="o">&lt;</span><span class="n">child</span><span class="o">&gt;</span><span class="w"></span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>A GtkRadioButton with indicator (see <a class="link" href="GtkToggleButton.html#gtk-toggle-button-set-mode" title="gtk_toggle_button_set_mode ()"><code class="function">gtk_toggle_button_set_mode()</code></a>) has a
main CSS node with name radiobutton and a subnode with name radio.</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="n">button</span><span class="p">.</span><span class="n">radio</span><span class="w"></span>
<span class="err">├──</span><span class="w"> </span><span class="n">radio</span><span class="w"></span>
<span class="err">╰──</span><span class="w"> </span><span class="o">&lt;</span><span class="n">child</span><span class="o">&gt;</span><span class="w"></span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>A GtkRadioButton without indicator changes the name of its main node
to button and adds a .radio style class to it. The subnode is invisible
in this case.</p>
<div class="refsect3">
<a name="id-1.3.9.4.10.9.8"></a><h4>How to create a group of two radio buttons.</h4>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="kt">void</span><span class="w"> </span><span class="nf">create_radio_buttons</span><span class="w"> </span><span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="n">GtkWidget</span><span class="w"> </span><span class="o">*</span><span class="n">window</span><span class="p">,</span><span class="w"> </span><span class="o">*</span><span class="n">radio1</span><span class="p">,</span><span class="w"> </span><span class="o">*</span><span class="n">radio2</span><span class="p">,</span><span class="w"> </span><span class="o">*</span><span class="n">box</span><span class="p">,</span><span class="w"> </span><span class="o">*</span><span class="n">entry</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="n">window</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">gtk_window_new</span><span class="w"> </span><span class="p">(</span><span class="n">GTK_WINDOW_TOPLEVEL</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="n">box</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">gtk_box_new</span><span class="w"> </span><span class="p">(</span><span class="n">GTK_ORIENTATION_VERTICAL</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="n">gtk_box_set_homogeneous</span><span class="w"> </span><span class="p">(</span><span class="n">GTK_BOX</span><span class="w"> </span><span class="p">(</span><span class="n">box</span><span class="p">),</span><span class="w"> </span><span class="n">TRUE</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="c1">// Create a radio button with a GtkEntry widget</span>
<span class="w"> </span><span class="n">radio1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">gtk_radio_button_new</span><span class="w"> </span><span class="p">(</span><span class="nb">NULL</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="n">entry</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">gtk_entry_new</span><span class="w"> </span><span class="p">();</span><span class="w"></span>
<span class="w"> </span><span class="n">gtk_container_add</span><span class="w"> </span><span class="p">(</span><span class="n">GTK_CONTAINER</span><span class="w"> </span><span class="p">(</span><span class="n">radio1</span><span class="p">),</span><span class="w"> </span><span class="n">entry</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="c1">// Create a radio button with a label</span>
<span class="w"> </span><span class="n">radio2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">gtk_radio_button_new_with_label_from_widget</span><span class="w"> </span><span class="p">(</span><span class="n">GTK_RADIO_BUTTON</span><span class="w"> </span><span class="p">(</span><span class="n">radio1</span><span class="p">),</span><span class="w"></span>
<span class="w"> </span><span class="s">&quot;Im the second radio button.&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="c1">// Pack them into a box, then show all the widgets</span>
<span class="w"> </span><span class="n">gtk_box_pack_start</span><span class="w"> </span><span class="p">(</span><span class="n">GTK_BOX</span><span class="w"> </span><span class="p">(</span><span class="n">box</span><span class="p">),</span><span class="w"> </span><span class="n">radio1</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="n">gtk_box_pack_start</span><span class="w"> </span><span class="p">(</span><span class="n">GTK_BOX</span><span class="w"> </span><span class="p">(</span><span class="n">box</span><span class="p">),</span><span class="w"> </span><span class="n">radio2</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="n">gtk_container_add</span><span class="w"> </span><span class="p">(</span><span class="n">GTK_CONTAINER</span><span class="w"> </span><span class="p">(</span><span class="n">window</span><span class="p">),</span><span class="w"> </span><span class="n">box</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="n">gtk_widget_show_all</span><span class="w"> </span><span class="p">(</span><span class="n">window</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="k">return</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>When an unselected button in the group is clicked the clicked button
receives the <a class="link" href="GtkToggleButton.html#GtkToggleButton-toggled" title="The “toggled” signal"><span class="type">“toggled”</span></a> signal, as does the previously
selected button.
Inside the <a class="link" href="GtkToggleButton.html#GtkToggleButton-toggled" title="The “toggled” signal"><span class="type">“toggled”</span></a> handler, <a class="link" href="GtkToggleButton.html#gtk-toggle-button-get-active" title="gtk_toggle_button_get_active ()"><code class="function">gtk_toggle_button_get_active()</code></a>
can be used to determine if the button has been selected or deselected.</p>
</div>
</div>
</div>
<div class="refsect1">
<a name="GtkRadioButton.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gtk-radio-button-new"></a><h3>gtk_radio_button_new ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_radio_button_new (<em class="parameter"><code><span class="type">GSList</span> *group</code></em>);</pre>
<p>Creates a new <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a>. To be of any practical value, a widget should
then be packed into the radio button.</p>
<div class="refsect3">
<a name="gtk-radio-button-new.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>group</p></td>
<td class="parameter_description"><p>an existing
radio button group, or <code class="literal">NULL</code> if you are creating a new group. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GtkRadioButton][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-radio-button-new.returns"></a><h4>Returns</h4>
<p> a new radio button</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-button-new-from-widget"></a><h3>gtk_radio_button_new_from_widget ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_radio_button_new_from_widget (<em class="parameter"><code><a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> *radio_group_member</code></em>);</pre>
<p>Creates a new <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a>, adding it to the same group as
<em class="parameter"><code>radio_group_member</code></em>
. As with <a class="link" href="GtkRadioButton.html#gtk-radio-button-new" title="gtk_radio_button_new ()"><code class="function">gtk_radio_button_new()</code></a>, a widget
should be packed into the radio button.</p>
<p><span class="annotation">[<acronym title="This symbol is a constructor, not a static method."><span class="acronym">constructor</span></acronym>]</span></p>
<div class="refsect3">
<a name="gtk-radio-button-new-from-widget.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>radio_group_member</p></td>
<td class="parameter_description"><p>an existing <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-radio-button-new-from-widget.returns"></a><h4>Returns</h4>
<p>a new radio button. </p>
<p><span class="annotation">[<acronym title="The data is owned by the callee, which is responsible of freeing it."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-button-new-with-label"></a><h3>gtk_radio_button_new_with_label ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_radio_button_new_with_label (<em class="parameter"><code><span class="type">GSList</span> *group</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *label</code></em>);</pre>
<p>Creates a new <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> with a text label.</p>
<div class="refsect3">
<a name="gtk-radio-button-new-with-label.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>group</p></td>
<td class="parameter_description"><p>an existing
radio button group, or <code class="literal">NULL</code> if you are creating a new group. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GtkRadioButton][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>label</p></td>
<td class="parameter_description"><p>the text label to display next to the radio button.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-radio-button-new-with-label.returns"></a><h4>Returns</h4>
<p> a new radio button.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-button-new-with-label-from-widget"></a><h3>gtk_radio_button_new_with_label_from_widget ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_radio_button_new_with_label_from_widget
(<em class="parameter"><code><a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> *radio_group_member</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *label</code></em>);</pre>
<p>Creates a new <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> with a text label, adding it to
the same group as <em class="parameter"><code>radio_group_member</code></em>
.</p>
<p><span class="annotation">[<acronym title="This symbol is a constructor, not a static method."><span class="acronym">constructor</span></acronym>]</span></p>
<div class="refsect3">
<a name="gtk-radio-button-new-with-label-from-widget.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>radio_group_member</p></td>
<td class="parameter_description"><p>widget to get radio group from or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>label</p></td>
<td class="parameter_description"><p>a text string to display next to the radio button.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-radio-button-new-with-label-from-widget.returns"></a><h4>Returns</h4>
<p>a new radio button. </p>
<p><span class="annotation">[<acronym title="The data is owned by the callee, which is responsible of freeing it."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-button-new-with-mnemonic"></a><h3>gtk_radio_button_new_with_mnemonic ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_radio_button_new_with_mnemonic (<em class="parameter"><code><span class="type">GSList</span> *group</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *label</code></em>);</pre>
<p>Creates a new <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> containing a label, adding it to the same
group as <em class="parameter"><code>group</code></em>
. The label will be created using
<a class="link" href="GtkLabel.html#gtk-label-new-with-mnemonic" title="gtk_label_new_with_mnemonic ()"><code class="function">gtk_label_new_with_mnemonic()</code></a>, so underscores in <em class="parameter"><code>label</code></em>
indicate the
mnemonic for the button.</p>
<div class="refsect3">
<a name="gtk-radio-button-new-with-mnemonic.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>group</p></td>
<td class="parameter_description"><p>the radio button
group, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GtkRadioButton][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>label</p></td>
<td class="parameter_description"><p>the text of the button, with an underscore in front of the
mnemonic character</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-radio-button-new-with-mnemonic.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-button-new-with-mnemonic-from-widget"></a><h3>gtk_radio_button_new_with_mnemonic_from_widget ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_radio_button_new_with_mnemonic_from_widget
(<em class="parameter"><code><a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> *radio_group_member</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *label</code></em>);</pre>
<p>Creates a new <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> containing a label. The label
will be created using <a class="link" href="GtkLabel.html#gtk-label-new-with-mnemonic" title="gtk_label_new_with_mnemonic ()"><code class="function">gtk_label_new_with_mnemonic()</code></a>, so underscores
in <em class="parameter"><code>label</code></em>
indicate the mnemonic for the button.</p>
<p><span class="annotation">[<acronym title="This symbol is a constructor, not a static method."><span class="acronym">constructor</span></acronym>]</span></p>
<div class="refsect3">
<a name="gtk-radio-button-new-with-mnemonic-from-widget.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>radio_group_member</p></td>
<td class="parameter_description"><p>widget to get radio group from or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>label</p></td>
<td class="parameter_description"><p>the text of the button, with an underscore in front of the
mnemonic character</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-radio-button-new-with-mnemonic-from-widget.returns"></a><h4>Returns</h4>
<p>a new <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a>. </p>
<p><span class="annotation">[<acronym title="The data is owned by the callee, which is responsible of freeing it."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-button-set-group"></a><h3>gtk_radio_button_set_group ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_radio_button_set_group (<em class="parameter"><code><a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> *radio_button</code></em>,
<em class="parameter"><code><span class="type">GSList</span> *group</code></em>);</pre>
<p>Sets a <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a>s group. It should be noted that this does not change
the layout of your interface in any way, so if you are changing the group,
it is likely you will need to re-arrange the user interface to reflect these
changes.</p>
<div class="refsect3">
<a name="gtk-radio-button-set-group.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>radio_button</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>group</p></td>
<td class="parameter_description"><p>an existing radio
button group, such as one returned from <a class="link" href="GtkRadioButton.html#gtk-radio-button-get-group" title="gtk_radio_button_get_group ()"><code class="function">gtk_radio_button_get_group()</code></a>, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GtkRadioButton][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-button-get-group"></a><h3>gtk_radio_button_get_group ()</h3>
<pre class="programlisting"><span class="returnvalue">GSList</span> *
gtk_radio_button_get_group (<em class="parameter"><code><a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> *radio_button</code></em>);</pre>
<p>Retrieves the group assigned to a radio button.</p>
<div class="refsect3">
<a name="gtk-radio-button-get-group.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>radio_button</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-radio-button-get-group.returns"></a><h4>Returns</h4>
<p>a linked list
containing all the radio buttons in the same group
as <em class="parameter"><code>radio_button</code></em>
. The returned list is owned by the radio button
and must not be modified or freed. </p>
<p><span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GtkRadioButton][<acronym title="The data is owned by the callee, which is responsible of freeing it."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-button-join-group"></a><h3>gtk_radio_button_join_group ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_radio_button_join_group (<em class="parameter"><code><a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> *radio_button</code></em>,
<em class="parameter"><code><a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> *group_source</code></em>);</pre>
<p>Joins a <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> object to the group of another <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> object</p>
<p>Use this in language bindings instead of the <a class="link" href="GtkRadioButton.html#gtk-radio-button-get-group" title="gtk_radio_button_get_group ()"><code class="function">gtk_radio_button_get_group()</code></a>
and <a class="link" href="GtkRadioButton.html#gtk-radio-button-set-group" title="gtk_radio_button_set_group ()"><code class="function">gtk_radio_button_set_group()</code></a> methods</p>
<p>A common way to set up a group of radio buttons is the following:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="n">GtkRadioButton</span><span class="w"> </span><span class="o">*</span><span class="n">radio_button</span><span class="p">;</span><span class="w"></span>
<span class="n">GtkRadioButton</span><span class="w"> </span><span class="o">*</span><span class="n">last_button</span><span class="p">;</span><span class="w"></span>
<span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">some_condition</span><span class="p">)</span><span class="w"></span>
<span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="n">radio_button</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">gtk_radio_button_new</span><span class="w"> </span><span class="p">(</span><span class="nb">NULL</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="n">gtk_radio_button_join_group</span><span class="w"> </span><span class="p">(</span><span class="n">radio_button</span><span class="p">,</span><span class="w"> </span><span class="n">last_button</span><span class="p">);</span><span class="w"></span>
<span class="w"> </span><span class="n">last_button</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">radio_button</span><span class="p">;</span><span class="w"></span>
<span class="w"> </span><span class="p">}</span><span class="w"></span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<div class="refsect3">
<a name="gtk-radio-button-join-group.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>radio_button</p></td>
<td class="parameter_description"><p>the <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> object</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>group_source</p></td>
<td class="parameter_description"><p>a radio button object whos group we are
joining, or <code class="literal">NULL</code> to remove the radio button from its group. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-3-0.html#api-index-3.0">3.0</a></p>
</div>
</div>
<div class="refsect1">
<a name="GtkRadioButton.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GtkRadioButton-struct"></a><h3>struct GtkRadioButton</h3>
<pre class="programlisting">struct GtkRadioButton;</pre>
</div>
</div>
<div class="refsect1">
<a name="GtkRadioButton.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GtkRadioButton--group"></a><h3>The <code class="literal">“group”</code> property</h3>
<pre class="programlisting"> “group” <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> *</pre>
<p>Sets a new group for a radio button.</p>
<p>Owner: GtkRadioButton</p>
<p>Flags: Write</p>
</div>
</div>
<div class="refsect1">
<a name="GtkRadioButton.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2">
<a name="GtkRadioButton-group-changed"></a><h3>The <code class="literal">“group-changed”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
user_function (<a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a> *button,
<span class="type">gpointer</span> user_data)</pre>
<p>Emitted when the group of radio buttons that a radio button belongs
to changes. This is emitted when a radio button switches from
being alone to being part of a group of 2 or more buttons, or
vice-versa, and when a button is moved from one group of 2 or
more buttons to a different one, but not when the composition
of the group that a button belongs to changes.</p>
<div class="refsect3">
<a name="GtkRadioButton-group-changed.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>button</p></td>
<td class="parameter_description"><p>the object which received the signal</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p>Flags: Run First</p>
<p class="since">Since: 2.4</p>
</div>
</div>
<div class="refsect1">
<a name="GtkRadioButton.see-also"></a><h2>See Also</h2>
<p><a class="link" href="GtkComboBox.html" title="GtkComboBox"><span class="type">GtkComboBox</span></a></p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>