New upstream version 3.23.0
This commit is contained in:
@ -3,12 +3,12 @@
|
||||
<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">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<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.27 (XML mode)">
|
||||
<meta name="generator" content="GTK-Doc V1.25 (XML mode)">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@ -212,102 +212,51 @@ use <a class="link" href="GtkRadioButton.html#gtk-radio-button-set-group" title=
|
||||
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="normal">radiobutton</span>
|
||||
<span class="normal">├── radio</span>
|
||||
<span class="normal">╰── </span><span class="symbol"><</span><span class="normal">child</span><span class="symbol">></span></pre></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
radiobutton
|
||||
├── radio
|
||||
╰── <child>
|
||||
</pre></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="normal">button</span><span class="symbol">.</span><span class="normal">radio</span>
|
||||
<span class="normal">├── radio</span>
|
||||
<span class="normal">╰── </span><span class="symbol"><</span><span class="normal">child</span><span class="symbol">></span></pre></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
button.radio
|
||||
├── radio
|
||||
╰── <child>
|
||||
</pre></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="type">void</span><span class="normal"> </span><span class="function">create_radio_buttons</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
void create_radio_buttons (void) {
|
||||
|
||||
<span class="normal"> </span><span class="usertype">GtkWidget</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">window</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">radio1</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">radio2</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">box</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">entry</span><span class="symbol">;</span>
|
||||
<span class="normal"> window </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GtkWindow.html#gtk-window-new">gtk_window_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="GtkWindow.html#GTK-WINDOW-TOPLEVEL:CAPS">GTK_WINDOW_TOPLEVEL</a></span><span class="symbol">);</span>
|
||||
<span class="normal"> box </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GtkBox.html#gtk-box-new">gtk_box_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="gtk3-Standard-Enumerations.html#GTK-ORIENTATION-VERTICAL:CAPS">GTK_ORIENTATION_VERTICAL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="number">2</span><span class="symbol">);</span>
|
||||
<span class="normal"> </span><span class="function"><a href="GtkBox.html#gtk-box-set-homogeneous">gtk_box_set_homogeneous</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GTK_BOX</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">box</span><span class="symbol">),</span><span class="normal"> TRUE</span><span class="symbol">);</span>
|
||||
GtkWidget *window, *radio1, *radio2, *box, *entry;
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
|
||||
gtk_box_set_homogeneous (GTK_BOX (box), TRUE);
|
||||
|
||||
<span class="normal"> </span><span class="comment">// Create a radio button with a GtkEntry widget</span>
|
||||
<span class="normal"> radio1 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GtkRadioButton.html#gtk-radio-button-new">gtk_radio_button_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">NULL</span><span class="symbol">);</span>
|
||||
<span class="normal"> entry </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GtkEntry.html#gtk-entry-new">gtk_entry_new</a></span><span class="normal"> </span><span class="symbol">();</span>
|
||||
<span class="normal"> </span><span class="function"><a href="GtkContainer.html#gtk-container-add">gtk_container_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GTK_CONTAINER</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">radio1</span><span class="symbol">),</span><span class="normal"> entry</span><span class="symbol">);</span>
|
||||
// Create a radio button with a GtkEntry widget
|
||||
radio1 = gtk_radio_button_new (NULL);
|
||||
entry = gtk_entry_new ();
|
||||
gtk_container_add (GTK_CONTAINER (radio1), entry);
|
||||
|
||||
|
||||
<span class="normal"> </span><span class="comment">// Create a radio button with a label</span>
|
||||
<span class="normal"> radio2 </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GtkRadioButton.html#gtk-radio-button-new-with-label-from-widget">gtk_radio_button_new_with_label_from_widget</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GTK_RADIO_BUTTON</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">radio1</span><span class="symbol">),</span>
|
||||
<span class="normal"> </span><span class="string">"I’m the second radio button."</span><span class="symbol">);</span>
|
||||
|
||||
<span class="normal"> </span><span class="comment">// Pack them into a box, then show all the widgets</span>
|
||||
<span class="normal"> </span><span class="function"><a href="GtkBox.html#gtk-box-pack-start">gtk_box_pack_start</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GTK_BOX</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">box</span><span class="symbol">),</span><span class="normal"> radio1</span><span class="symbol">);</span>
|
||||
<span class="normal"> </span><span class="function"><a href="GtkBox.html#gtk-box-pack-start">gtk_box_pack_start</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GTK_BOX</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">box</span><span class="symbol">),</span><span class="normal"> radio2</span><span class="symbol">);</span>
|
||||
<span class="normal"> </span><span class="function"><a href="GtkContainer.html#gtk-container-add">gtk_container_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GTK_CONTAINER</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">window</span><span class="symbol">),</span><span class="normal"> box</span><span class="symbol">);</span>
|
||||
<span class="normal"> </span><span class="function"><a href="GtkWidget.html#gtk-widget-show-all">gtk_widget_show_all</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">window</span><span class="symbol">);</span>
|
||||
<span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
|
||||
<span class="cbracket">}</span></pre></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
// Create a radio button with a label
|
||||
radio2 = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio1),
|
||||
"I’m the second radio button.");
|
||||
|
||||
// Pack them into a box, then show all the widgets
|
||||
gtk_box_pack_start (GTK_BOX (box), radio1);
|
||||
gtk_box_pack_start (GTK_BOX (box), radio2);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
gtk_widget_show_all (window);
|
||||
return;
|
||||
}
|
||||
</pre></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
|
||||
@ -335,7 +284,7 @@ then be packed into the radio button.</p>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>group</p></td>
|
||||
<td class="parameter_description"><p>an existing
|
||||
<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>
|
||||
@ -366,14 +315,14 @@ should be packed into the radio button.</p>
|
||||
</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_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> a new radio button. </p>
|
||||
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
|
||||
</div>
|
||||
</div>
|
||||
@ -395,7 +344,7 @@ gtk_radio_button_new_with_label (<em class="parameter"><code><span class="type">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>group</p></td>
|
||||
<td class="parameter_description"><p>an existing
|
||||
<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>
|
||||
@ -434,7 +383,7 @@ the same group as <em class="parameter"><code>radio_group_member</code></em>
|
||||
<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_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>
|
||||
@ -447,7 +396,7 @@ the same group as <em class="parameter"><code>radio_group_member</code></em>
|
||||
</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> a new radio button. </p>
|
||||
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
|
||||
</div>
|
||||
</div>
|
||||
@ -474,7 +423,7 @@ mnemonic for the button.</p>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>group</p></td>
|
||||
<td class="parameter_description"><p>the radio button
|
||||
<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>
|
||||
@ -515,7 +464,7 @@ in <em class="parameter"><code>label</code></em>
|
||||
<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_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>
|
||||
@ -529,7 +478,7 @@ mnemonic character</p></td>
|
||||
</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> a new <a class="link" href="GtkRadioButton.html" title="GtkRadioButton"><span class="type">GtkRadioButton</span></a>. </p>
|
||||
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
|
||||
</div>
|
||||
</div>
|
||||
@ -559,7 +508,7 @@ changes.</p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>group</p></td>
|
||||
<td class="parameter_description"><p>an existing radio
|
||||
<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>
|
||||
@ -590,7 +539,7 @@ gtk_radio_button_get_group (<em class="parameter"><code><a class="link" href="Gt
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="gtk-radio-button-get-group.returns"></a><h4>Returns</h4>
|
||||
<p>a linked list
|
||||
<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
|
||||
@ -608,35 +557,18 @@ gtk_radio_button_join_group (<em class="parameter"><code><a class="link" href="G
|
||||
<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="usertype">GtkRadioButton</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">radio_button</span><span class="symbol">;</span>
|
||||
<span class="usertype">GtkRadioButton</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">last_button</span><span class="symbol">;</span>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
GtkRadioButton *radio_button;
|
||||
GtkRadioButton *last_button;
|
||||
|
||||
<span class="keyword">while</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">some_condition</span><span class="symbol">)</span>
|
||||
<span class="normal"> </span><span class="cbracket">{</span>
|
||||
<span class="normal"> radio_button </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GtkRadioButton.html#gtk-radio-button-new">gtk_radio_button_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">NULL</span><span class="symbol">);</span>
|
||||
|
||||
<span class="normal"> </span><span class="function"><a href="GtkRadioButton.html#gtk-radio-button-join-group">gtk_radio_button_join_group</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">radio_button</span><span class="symbol">,</span><span class="normal"> last_button</span><span class="symbol">);</span>
|
||||
<span class="normal"> last_button </span><span class="symbol">=</span><span class="normal"> radio_button</span><span class="symbol">;</span>
|
||||
<span class="normal"> </span><span class="cbracket">}</span></pre></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
while (some_condition)
|
||||
{
|
||||
radio_button = gtk_radio_button_new (NULL);
|
||||
|
||||
gtk_radio_button_join_group (radio_button, last_button);
|
||||
last_button = radio_button;
|
||||
}
|
||||
</pre></div>
|
||||
<p></p>
|
||||
<div class="refsect3">
|
||||
<a name="gtk-radio-button-join-group.parameters"></a><h4>Parameters</h4>
|
||||
@ -654,7 +586,7 @@ and <a class="link" href="GtkRadioButton.html#gtk-radio-button-set-group" title=
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>group_source</p></td>
|
||||
<td class="parameter_description"><p>a radio button object whos group we are
|
||||
<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>
|
||||
@ -725,6 +657,6 @@ of the group that a button belongs to changes.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr>Generated by GTK-Doc V1.27</div>
|
||||
<hr>Generated by GTK-Doc V1.25</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user