|  |  |  | GTK+ 3 Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Style Properties | Signals | ||||
#include <gtk/gtk.h> struct GtkSwitch; GtkWidget * gtk_switch_new (void); void gtk_switch_set_active (GtkSwitch *sw,gboolean is_active); gboolean gtk_switch_get_active (GtkSwitch *sw);
GtkSwitch implements AtkImplementorIface, GtkBuildable, GtkActionable and GtkActivatable.
GtkSwitch is a widget that has two states: on or off. The user can control which state should be active by clicking the empty area, or by dragging the handle.
struct GtkSwitch;
The GtkSwitch structure contains private data and it should only be accessed using the provided API.
GtkWidget *         gtk_switch_new                      (void);
Creates a new GtkSwitch widget.
| Returns : | the newly created GtkSwitch instance | 
Since 3.0
void gtk_switch_set_active (GtkSwitch *sw,gboolean is_active);
Changes the state of sw to the desired one.
| 
 | a GtkSwitch | 
| 
 | TRUEifswshould be active, andFALSEotherwise | 
Since 3.0
"active" property  "active"                   gboolean              : Read / Write
Whether the GtkSwitch widget is in its on or off state.
Default value: FALSE
"slider-width" style property  "slider-width"             gint                  : Read
The minimum width of the GtkSwitch handle, in pixels.
Allowed values: >= 36
Default value: 36
"activate" signalvoid                user_function                      (GtkSwitch *widget,
                                                        gpointer   user_data)      : Action
The ::activate signal on GtkSwitch is an action signal and emitting it causes the switch to animate. Applications should never connect to this signal, but use the notify::active signal.
| 
 | the object which received the signal. | 
| 
 | user data set when the signal handler was connected. |