Add GtkSwitch to the widget gallery

This commit is contained in:
Matthias Clasen 2010-11-29 11:23:07 -05:00
parent 0ca07a6df7
commit 99aa90b0bc
4 changed files with 27 additions and 1 deletions

View File

@ -322,7 +322,8 @@ HTML_IMAGES = \
$(srcdir)/images/layout-tblr.png \
$(srcdir)/images/layout-tbrl.png \
$(srcdir)/images/window-default.png \
$(srcdir)/images/hello-world.png
$(srcdir)/images/hello-world.png \
$(srcdir)/images/switch.png
# Extra options to supply to gtkdoc-fixref
FIXXREF_OPTIONS=--extra-dir=../gdk/html \

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -123,4 +123,7 @@
<link linkend="GtkFileChooserDialog">
<inlinegraphic fileref="filechooser.png" format="PNG"></inlinegraphic>
</link>
<link linkend="GtkSwitch">
<inlinegraphic fileref="switch.png" format="PNG"></inlinegraphic>
</link>
</para>

View File

@ -115,6 +115,7 @@ new_widget_info (const char *name,
else
{
info->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_has_resize_grip (GTK_WINDOW (info->window), FALSE);
info->include_decorations = FALSE;
gtk_widget_show_all (widget);
gtk_container_add (GTK_CONTAINER (info->window), widget);
@ -159,6 +160,26 @@ create_button (void)
return new_widget_info ("button", align, SMALL);
}
static WidgetInfo *
create_switch (void)
{
GtkWidget *widget;
GtkWidget *align;
GtkWidget *sw;
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
sw = gtk_switch_new ();
gtk_switch_set_active (GTK_SWITCH (sw), TRUE);
gtk_box_pack_start (GTK_BOX (widget), sw, TRUE, TRUE, 0);
sw = gtk_switch_new ();
gtk_box_pack_start (GTK_BOX (widget), sw, TRUE, TRUE, 0);
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_container_add (GTK_CONTAINER (align), widget);
return new_widget_info ("switch", align, SMALL);
}
static WidgetInfo *
create_toggle_button (void)
{
@ -1095,6 +1116,7 @@ get_all_widgets (void)
retval = g_list_prepend (retval, create_page_setup_dialog ());
retval = g_list_prepend (retval, create_print_dialog ());
retval = g_list_prepend (retval, create_volume_button ());
retval = g_list_prepend (retval, create_switch ());
return retval;
}