分类: C/C++
2009-03-01 20:56:20
void toggle_button_callback (GtkWidget *widget, gpointer data)设定其处于何种状态的函数
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
{
/* If control reaches here, the toggle button is down */
} else {
/* If control reaches here, the toggle button is up */
}
}
void gtk_toggle_button_set_active( GtkToggleButton *toggle_button,得到其处于何种状态的函数
gboolean is_active );
gboolean gtk_toggle_button_get_active (GtkToggleButton *toggle_button);
GtkWidget *gtk_check_button_new( void );其它函数跟toggle按钮的是相同的。
GtkWidget *gtk_check_button_new_with_label ( const gchar *label );
GtkWidget *gtk_check_button_new_with_mnemonic ( const gchar *label );
GtkWidget *gtk_radio_button_new( GSList *group );还有一个更省事的,直接省GET函数
GtkWidget *gtk_radio_button_new_from_widget( GtkRadioButton *group );
GtkWidget *gtk_radio_button_new_with_label( GSList *group,
const gchar *label );
GtkWidget* gtk_radio_button_new_with_label_from_widget( GtkRadioButton *group,
const gchar *label );
GtkWidget *gtk_radio_button_new_with_mnemonic( GSList *group,
const gchar *label );
GtkWidget *gtk_radio_button_new_with_mnemonic_from_widget( GtkRadioButton *group,
const gchar *label );
不过通常是不创建一个新GSList,然后来用。
而是下面这样。
GSList *gtk_radio_button_get_group( GtkRadioButton *radio_button );
直接用第一个按钮的,而第一个通常是用NULL来代替GSList
button2 = gtk_radio_button_new_with_label(
gtk_radio_button_get_group (GTK_RADIO_BUTTON (button1)),
"button2");
button2 = gtk_radio_button_new_with_label_from_widget(
GTK_RADIO_BUTTON (button1),
"button2");