gtkradiobutton.html
来自「该压缩包包含了GTK+的大量API函数」· HTML 代码 · 共 1,223 行 · 第 1/2 页
HTML
1,223 行
<HTML><HEAD><TITLE>GtkRadioButton</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.61"><LINKREL="HOME"TITLE="GTK+ Reference Manual"HREF="index.html"><LINKREL="UP"TITLE="GTK+ Widgets and Objects"HREF="gtkobjects.html"><LINKREL="PREVIOUS"TITLE="GtkProgressBar"HREF="gtkprogressbar.html"><LINKREL="NEXT"TITLE="GtkRadioMenuItem"HREF="gtkradiomenuitem.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"BGCOLOR="#000000"CELLPADDING="1"CELLSPACING="0"><TR><THCOLSPAN="4"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="5">GTK+ Reference Manual</FONT></TH></TR><TR><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="left"><AHREF="gtkprogressbar.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B><<< Previous Page</B></FONT></A></TD><TDWIDTH="25%"BGCOLOR="#0000C0"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="index.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Home</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#00C000"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="gtkobjects.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Up</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="right"><AHREF="gtkradiomenuitem.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Next Page >>></B></FONT></A></TD></TR></TABLE></DIV><H1><ANAME="GTKRADIOBUTTON">GtkRadioButton</A></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN37477"></A><H2>Name</H2>GtkRadioButton -- A choice from multiple check buttons.</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN37480"></A><H2>Synopsis</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS"> #include <gtk/gtk.h>struct <AHREF="gtkradiobutton.html#GTKRADIOBUTTON-STRUCT">GtkRadioButton</A>;<AHREF="gtkwidget.html">GtkWidget</A>* <AHREF="gtkradiobutton.html#GTK-RADIO-BUTTON-NEW">gtk_radio_button_new</A> (<AHREF=../glib/glib-singly-linked-lists.html#GSLIST>GSList</A> *group);<AHREF="gtkwidget.html">GtkWidget</A>* <AHREF="gtkradiobutton.html#GTK-RADIO-BUTTON-NEW-FROM-WIDGET">gtk_radio_button_new_from_widget</A> (<AHREF="gtkradiobutton.html">GtkRadioButton</A> *group);<AHREF="gtkwidget.html">GtkWidget</A>* <AHREF="gtkradiobutton.html#GTK-RADIO-BUTTON-NEW-WITH-LABEL">gtk_radio_button_new_with_label</A> (<AHREF=../glib/glib-singly-linked-lists.html#GSLIST>GSList</A> *group, const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *label);<AHREF="gtkwidget.html">GtkWidget</A>* <AHREF="gtkradiobutton.html#GTK-RADIO-BUTTON-NEW-WITH-LABEL-FROM-WIDGET">gtk_radio_button_new_with_label_from_widget</A> (<AHREF="gtkradiobutton.html">GtkRadioButton</A> *group, const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *label);<AHREF=../glib/glib-singly-linked-lists.html#GSLIST>GSList</A>* <AHREF="gtkradiobutton.html#GTK-RADIO-BUTTON-GROUP">gtk_radio_button_group</A> (<AHREF="gtkradiobutton.html">GtkRadioButton</A> *radio_button);void <AHREF="gtkradiobutton.html#GTK-RADIO-BUTTON-SET-GROUP">gtk_radio_button_set_group</A> (<AHREF="gtkradiobutton.html">GtkRadioButton</A> *radio_button, <AHREF=../glib/glib-singly-linked-lists.html#GSLIST>GSList</A> *group); </PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN37504"></A><H2>Object Hierarchy</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS"> <AHREF="gtkobject.html">GtkObject</A> +----<AHREF="gtkwidget.html">GtkWidget</A> +----<AHREF="gtkcontainer.html">GtkContainer</A> +----<AHREF="gtkbin.html">GtkBin</A> +----<AHREF="gtkbutton.html">GtkButton</A> +----<AHREF="gtktogglebutton.html">GtkToggleButton</A> +----<AHREF="gtkcheckbutton.html">GtkCheckButton</A> +----GtkRadioButton</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN37514"></A><H2>Args</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS"> "<AHREF="gtkradiobutton.html#GTKRADIOBUTTON--GROUP">group</A>" <AHREF="gtkradiobutton.html">GtkRadioButton</A> : Write</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN37519"></A><H2>Description</H2><P>A single radio button performs the same basic function as a <AHREF="gtkcheckbutton.html">GtkCheckButton</A>,as it's position in the object hierarchy reflects. It is only when multipleradio buttons are grouped together that they become a different userinterface component in their own right.</P><P>Every radio button is a member of some group of radio buttons. When one is selected, all otherradio buttons in the same group are deselected. A <AHREF="gtkradiobutton.html">GtkRadioButton</A> is one wayof giving the user a choice from many options.</P><P>Radio button widgets are created with <AHREF="gtkradiobutton.html#GTK-RADIO-BUTTON-NEW">gtk_radio_button_new</A>(), passing NULLas the argument if this is the first radio button in a group. In subsequentcalls, the group you wish to add this button to should be passed as anargument. Optionally, <AHREF="gtkradiobutton.html#GTK-RADIO-BUTTON-NEW-WITH-LABEL">gtk_radio_button_new_with_label</A>() can be used if youwant a text label on the radio button.</P><P>Alternatively, when adding widgets to an existing group of radio buttons,use <AHREF="gtkradiobutton.html#GTK-RADIO-BUTTON-NEW-FROM-WIDGET">gtk_radio_button_new_from_widget</A>() with a <AHREF="gtkradiobutton.html">GtkRadioButton</A> that alreadyhas a group assigned to it. The convenience function<AHREF="gtkradiobutton.html#GTK-RADIO-BUTTON-NEW-WITH-LABEL-FROM-WIDGET">gtk_radio_button_new_with_label_from_widget</A>() is also provided.</P><P>To retrieve the group a <AHREF="gtkradiobutton.html">GtkRadioButton</A> is assigned to, use<AHREF="gtkradiobutton.html#GTK-RADIO-BUTTON-GROUP">gtk_radio_button_group</A>().</P><P>To remove a <AHREF="gtkradiobutton.html">GtkRadioButton</A> from one group and make it part of a new one, use <AHREF="gtkradiobutton.html#GTK-RADIO-BUTTON-SET-GROUP">gtk_radio_button_set_group</A>().</P><P><DIVCLASS="EXAMPLE"><ANAME="AEN37539"></A><P><B>Example 1. How to create a group of two radio buttons.</B></P><TABLEBORDER="0"BGCOLOR="#D8F8D8"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"> void create_radio_buttons(void) { GtkWidget *window, *radio1, *radio2, *box, *entry; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); box = gtk_vbox_new(TRUE, 2); /* Create a radio button with a <AHREF="gtkentry.html">GtkEntry</A> widget */ radio1 = gtk_radio_button_new(NULL); entry = <AHREF="gtkentry.html#GTK-ENTRY-NEW">gtk_entry_new</A>(); gtk_container_add(GTK_CONTAINER(radio1), entry); /* 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, TRUE, TRUE, 2); gtk_box_pack_start(GTK_BOX(box), radio2, TRUE, TRUE, 2); gtk_container_add(GTK_CONTAINER(window), box); gtk_widget_show_all (window); return;} </PRE></TD></TR></TABLE></DIV></P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN37544"></A><H2>Details</H2><DIVCLASS="REFSECT2"><ANAME="AEN37546"></A><H3><ANAME="GTKRADIOBUTTON-STRUCT"></A>struct GtkRadioButton</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">struct GtkRadioButton;</PRE></TD></TR></TABLE><P>Contains only private data that should be read and manipulated using thefunctions below.</P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN37551"></A><H3><ANAME="GTK-RADIO-BUTTON-NEW"></A>gtk_radio_button_new ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF="gtkwidget.html">GtkWidget</A>* gtk_radio_button_new (<AHREF=../glib/glib-singly-linked-lists.html#GSLIST>GSList</A> *group);</PRE></TD></TR></TABLE><P>Creates a new <AHREF="gtkradiobutton.html">GtkRadioButton</A>. To be of any practical value, a widget shouldthen be packed into the radio button.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN37559"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>group</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">an existing radio button group, or NULL if you are creating a new group.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a new radio button. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN37572"></A><H3><ANAME="GTK-RADIO-BUTTON-NEW-FROM-WIDGET"></A>gtk_radio_button_new_from_widget ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF="gtkwidget.html">GtkWidget</A>* gtk_radio_button_new_from_widget (<AHREF="gtkradiobutton.html">GtkRadioButton</A> *group);</PRE></TD></TR></TABLE><P>Creates a new <AHREF="gtkradiobutton.html">GtkRadioButton</A>, adding it to the same group as <TTCLASS="PARAMETER"><I>group</I></TT>. Aswith <AHREF="gtkradiobutton.html#GTK-RADIO-BUTTON-NEW">gtk_radio_button_new</A>(), a widget should be packed into the radio button.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN37582"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>group</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?