diff --git a/docs/reference/gtk/Makefile.am b/docs/reference/gtk/Makefile.am index 47467f622c..fc0bcafb4e 100644 --- a/docs/reference/gtk/Makefile.am +++ b/docs/reference/gtk/Makefile.am @@ -318,6 +318,7 @@ HTML_IMAGES = \ $(srcdir)/images/fontsel.png \ $(srcdir)/images/fontchooser.png \ $(srcdir)/images/frame.png \ + $(srcdir)/images/headerbar.png \ $(srcdir)/images/icon-view.png \ $(srcdir)/images/image.png \ $(srcdir)/images/info-bar.png \ @@ -337,6 +338,7 @@ HTML_IMAGES = \ $(srcdir)/images/notebook.png \ $(srcdir)/images/panes.png \ $(srcdir)/images/pagesetupdialog.png \ + $(srcdir)/images/placessidebar.png \ $(srcdir)/images/printdialog.png \ $(srcdir)/images/progressbar.png \ $(srcdir)/images/radio-group.png \ @@ -348,6 +350,8 @@ HTML_IMAGES = \ $(srcdir)/images/separator.png \ $(srcdir)/images/spinbutton.png \ $(srcdir)/images/spinner.png \ + $(srcdir)/images/stack.png \ + $(srcdir)/images/stackswitcher.png \ $(srcdir)/images/statusbar.png \ $(srcdir)/images/toggle-button.png \ $(srcdir)/images/toolbar.png \ diff --git a/docs/reference/gtk/gtk3.types.in b/docs/reference/gtk/gtk3.types.in index 0dcb1ea1ec..df3a451b32 100644 --- a/docs/reference/gtk/gtk3.types.in +++ b/docs/reference/gtk/gtk3.types.in @@ -81,6 +81,7 @@ gtk_grid_get_type gtk_handle_box_get_type gtk_hbox_get_type gtk_hbutton_box_get_type +gtk_header_bar_get_type gtk_hpaned_get_type gtk_hscale_get_type gtk_hscrollbar_get_type @@ -119,6 +120,7 @@ gtk_page_setup_get_type @DISABLE_ON_W32@gtk_page_setup_unix_dialog_get_type gtk_paned_get_type gtk_paper_size_get_type +gtk_places_sidebar_get_type @DISABLE_ON_W32@@DISABLE_ON_QUARTZ@@DISABLE_ON_WAYLAND@gtk_plug_get_type @DISABLE_ON_W32@gtk_printer_get_type gtk_print_context_get_type @@ -154,6 +156,8 @@ gtk_size_group_get_type @DISABLE_ON_W32@@DISABLE_ON_QUARTZ@@DISABLE_ON_WAYLAND@gtk_socket_get_type gtk_spin_button_get_type gtk_spinner_get_type +gtk_stack_get_type +gtk_stack_switcher_get_type gtk_statusbar_get_type gtk_status_icon_get_type gtk_switch_get_type diff --git a/docs/reference/gtk/images/headerbar.png b/docs/reference/gtk/images/headerbar.png new file mode 100644 index 0000000000..423b62d655 Binary files /dev/null and b/docs/reference/gtk/images/headerbar.png differ diff --git a/docs/reference/gtk/images/placessidebar.png b/docs/reference/gtk/images/placessidebar.png new file mode 100644 index 0000000000..e1806d4834 Binary files /dev/null and b/docs/reference/gtk/images/placessidebar.png differ diff --git a/docs/reference/gtk/images/stack.png b/docs/reference/gtk/images/stack.png new file mode 100644 index 0000000000..69ed19844b Binary files /dev/null and b/docs/reference/gtk/images/stack.png differ diff --git a/docs/reference/gtk/images/stackswitcher.png b/docs/reference/gtk/images/stackswitcher.png new file mode 100644 index 0000000000..e002d66725 Binary files /dev/null and b/docs/reference/gtk/images/stackswitcher.png differ diff --git a/docs/reference/gtk/visual_index.xml b/docs/reference/gtk/visual_index.xml index 589979fac5..ace2915b43 100644 --- a/docs/reference/gtk/visual_index.xml +++ b/docs/reference/gtk/visual_index.xml @@ -159,4 +159,16 @@ + + + + + + + + + + + + diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c index 2c125b0dfc..0774b0e392 100644 --- a/docs/tools/widgets.c +++ b/docs/tools/widgets.c @@ -119,6 +119,7 @@ new_widget_info (const char *name, { info->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_has_resize_grip (GTK_WINDOW (info->window), FALSE); + gtk_container_set_border_width (GTK_CONTAINER (info->window), 12); info->include_decorations = FALSE; gtk_widget_show_all (widget); gtk_container_add (GTK_CONTAINER (info->window), widget); @@ -127,7 +128,6 @@ new_widget_info (const char *name, gtk_widget_set_app_paintable (info->window, TRUE); g_signal_connect (info->window, "focus", G_CALLBACK (gtk_true), NULL); - gtk_container_set_border_width (GTK_CONTAINER (info->window), 12); switch (size) { @@ -1300,11 +1300,131 @@ create_colorchooserdialog (void) return info; } +static WidgetInfo * +create_headerbar (void) +{ + GtkWidget *window; + GtkWidget *bar; + GtkWidget *align; + GtkWidget *view; + GtkWidget *button; + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_container_set_border_width (GTK_CONTAINER (window), 0); + view = gtk_text_view_new (); + gtk_widget_show (view); + gtk_widget_set_size_request (window, 220, 150); + gtk_container_add (GTK_CONTAINER (window), view); + bar = gtk_header_bar_new (); + gtk_header_bar_set_title (GTK_HEADER_BAR (bar), "Header Bar"); + gtk_header_bar_set_subtitle (GTK_HEADER_BAR (bar), "(subtitle)"); + gtk_window_set_titlebar (GTK_WINDOW (window), bar); + button = gtk_button_new (); + gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("bookmark-new-symbolic", GTK_ICON_SIZE_BUTTON)); + gtk_widget_show_all (button); + gtk_header_bar_pack_end (GTK_HEADER_BAR (bar), button); + + return new_widget_info ("headerbar", window, ASIS); +} + +static WidgetInfo * +create_placessidebar (void) +{ + GtkWidget *bar; + GtkWidget *vbox; + GtkWidget *align; + + bar = gtk_places_sidebar_new (); + gtk_widget_set_size_request (bar, 150, 300); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); + align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); + + gtk_container_add (GTK_CONTAINER (align), bar); + gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), + gtk_label_new ("Places Sidebar"), + FALSE, FALSE, 0); + + return new_widget_info ("placessidebar", vbox, ASIS); +} + +static WidgetInfo * +create_stack (void) +{ + GtkWidget *stack; + GtkWidget *switcher; + GtkWidget *vbox; + GtkWidget *view; + + stack = gtk_stack_new (); + gtk_widget_set_margin_top (stack, 10); + gtk_widget_set_margin_bottom (stack, 10); + gtk_widget_set_size_request (stack, 120, 120); + view = gtk_text_view_new (); + gtk_widget_show (view); + gtk_stack_add_titled (GTK_STACK (stack), view, "page1", "Page 1"); + view = gtk_text_view_new (); + gtk_widget_show (view); + gtk_stack_add_titled (GTK_STACK (stack), view, "page2", "Page 2"); + + switcher = gtk_stack_switcher_new (); + gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (stack)); + gtk_widget_set_halign (switcher, GTK_ALIGN_CENTER); + + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + + gtk_box_pack_start (GTK_BOX (vbox), switcher, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), stack, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), + gtk_label_new ("Stack"), + FALSE, FALSE, 0); + + return new_widget_info ("stack", vbox, ASIS); +} + +static WidgetInfo * +create_stack_switcher (void) +{ + GtkWidget *stack; + GtkWidget *switcher; + GtkWidget *vbox; + GtkWidget *view; + + stack = gtk_stack_new (); + gtk_widget_set_margin_top (stack, 10); + gtk_widget_set_margin_bottom (stack, 10); + gtk_widget_set_size_request (stack, 120, 120); + view = gtk_text_view_new (); + gtk_widget_show (view); + gtk_stack_add_titled (GTK_STACK (stack), view, "page1", "Page 1"); + view = gtk_text_view_new (); + gtk_widget_show (view); + gtk_stack_add_titled (GTK_STACK (stack), view, "page2", "Page 2"); + + switcher = gtk_stack_switcher_new (); + gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (stack)); + gtk_widget_set_halign (switcher, GTK_ALIGN_CENTER); + + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + + gtk_box_pack_start (GTK_BOX (vbox), switcher, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), stack, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), + gtk_label_new ("Stack Switcher"), + FALSE, FALSE, 0); + + return new_widget_info ("stackswitcher", vbox, ASIS); +} + GList * get_all_widgets (void) { GList *retval = NULL; + retval = g_list_prepend (retval, create_headerbar ()); + retval = g_list_prepend (retval, create_placessidebar ()); + retval = g_list_prepend (retval, create_stack ()); + retval = g_list_prepend (retval, create_stack_switcher ()); retval = g_list_prepend (retval, create_toolpalette ()); retval = g_list_prepend (retval, create_spinner ()); retval = g_list_prepend (retval, create_about_dialog ());