docs: Add GtkPopover to the widget gallery

This commit is contained in:
Matthias Clasen 2020-10-26 00:09:55 -04:00
parent bed3616bf0
commit 65f748fc62
4 changed files with 26 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -337,6 +337,7 @@ images = [
'images/panes.png',
'images/password-entry.png',
'images/picture.png',
'images/popover.png',
'images/popup-anchors.png',
'images/popup-at.svg',
'images/popup-flip.png',

View File

@ -78,6 +78,7 @@
<link linkend="GtkStack"><inlinegraphic fileref="stack.png" format="PNG"></inlinegraphic></link>
<link linkend="GtkStackSwitcher"><inlinegraphic fileref="stackswitcher.png" format="PNG"></inlinegraphic></link>
<link linkend="GtkStackSidebar"><inlinegraphic fileref="sidebar.png" format="PNG"></inlinegraphic></link>
<link linkend="GtkPopover"><inlinegraphic fileref="popover.png" format="PNG"></inlinegraphic></link>
</para>
</section>

View File

@ -39,6 +39,7 @@ new_widget_info (const char *name,
info->snapshot_popover = TRUE;
info->window = gtk_window_new ();
gtk_window_set_default_size (GTK_WINDOW (info->window), 200, 200);
gtk_window_set_decorated (GTK_WINDOW (info->window), FALSE);
info->include_decorations = TRUE;
button = gtk_menu_button_new ();
@ -1640,6 +1641,28 @@ create_menu_bar (void)
return new_widget_info ("menubar", vbox, SMALL);
}
static WidgetInfo *
create_popover (void)
{
GtkWidget *widget;
GtkWidget *child;
WidgetInfo *info;
widget = gtk_popover_new ();
gtk_widget_set_size_request (widget, 180, 180);
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
g_object_set (widget, "autohide", FALSE, NULL);
child = gtk_label_new ("Popover");
gtk_widget_set_halign (child, GTK_ALIGN_CENTER);
gtk_widget_set_valign (child, GTK_ALIGN_CENTER);
gtk_popover_set_child (GTK_POPOVER (widget), child);
info = new_widget_info ("popover", widget, ASIS);
info->wait = 100;
return info;
}
GList *
get_all_widgets (void)
{
@ -1710,6 +1733,7 @@ get_all_widgets (void)
retval = g_list_prepend (retval, create_emojichooser ());
retval = g_list_prepend (retval, create_expander ());
retval = g_list_prepend (retval, create_menu_bar ());
retval = g_list_prepend (retval, create_popover ());
return retval;
}