
@c %start of fragment

@node GtkToggleButton
@chapter GtkToggleButton
Create buttons which retain their state

@section Overview
A @code{<gtk-toggle-button>} is a @code{<gtk-button>} which will remain
'pressed-in' when clicked. Clicking again will cause the toggle button to return
to its normal state.

A toggle button is created by calling either @code{gtk-toggle-button-new} or
@code{gtk-toggle-button-new-with-label}. If using the former, it is advisable to
pack a widget, (such as a @code{<gtk-label>} and/or a @code{<gtk-pixmap>}), into
the toggle button's container. (See @code{<gtk-button>} for more information).

The state of a @code{<gtk-toggle-button>} can be set specifically using
@code{gtk-toggle-button-set-active}, and retrieved using
@code{gtk-toggle-button-get-active}.

To simply switch the state of a toggle button, use gtk_toggle_button_toggled.

@example 


void make_toggles (void) @{
   GtkWidget *dialog, *toggle1, *toggle2;

   dialog = gtk_dialog_new ();
   toggle1 = gtk_toggle_button_new_with_label ("Hi, i'm a toggle button.");

   /* Makes this toggle button invisible */
   gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle1), TRUE);
   
   g_signal_connect (toggle1, "toggled",
                     G_CALLBACK (output_state), NULL);
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area),
                       toggle1, FALSE, FALSE, 2);

   toggle2 = gtk_toggle_button_new_with_label ("Hi, i'm another toggle button.");
   gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle2), FALSE);
   g_signal_connect (toggle2, "toggled",
                     G_CALLBACK (output_state), NULL);
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area),
                       toggle2, FALSE, FALSE, 2);

   gtk_widget_show_all (dialog);
@}

@end example

@section Usage
@include defuns-gtktogglebutton.xml.texi

@c %end of fragment
