summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-10-25 23:57:12 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-10-26 01:08:49 -0400
commitbed3616bf0886c74305a426e817ddeee8d1b21cb (patch)
tree162fe41b2b6b1512970ff12e1058922bd222c430
parent1605ca01406f2a8bc0061ae37c97dd2e640ff76a (diff)
downloadgtk+-bed3616bf0886c74305a426e817ddeee8d1b21cb.tar.gz
docs: Add GtkPopoverMenuBar to the gallery
-rw-r--r--docs/reference/gtk/images/menubar.pngbin3103 -> 3709 bytes
-rw-r--r--docs/reference/gtk/visual_index.xml1
-rw-r--r--docs/tools/widgets.c52
3 files changed, 53 insertions, 0 deletions
diff --git a/docs/reference/gtk/images/menubar.png b/docs/reference/gtk/images/menubar.png
index 26304f23c0..237ffb6ce4 100644
--- a/docs/reference/gtk/images/menubar.png
+++ b/docs/reference/gtk/images/menubar.png
Binary files differ
diff --git a/docs/reference/gtk/visual_index.xml b/docs/reference/gtk/visual_index.xml
index 80daea4717..8c8329b2c0 100644
--- a/docs/reference/gtk/visual_index.xml
+++ b/docs/reference/gtk/visual_index.xml
@@ -24,6 +24,7 @@
<link linkend="GtkMediaControls"><inlinegraphic fileref="media-controls.png" format="PNG"></inlinegraphic></link>
<link linkend="GtkWindowControls"><inlinegraphic fileref="windowcontrols.png" format="PNG"></inlinegraphic></link>
<link linkend="GtkEmojiChooser"><inlinegraphic fileref="emojichooser.png" format="PNG"></inlinegraphic></link>
+ <link linkend="GtkPopoverMenu"><inlinegraphic fileref="menubar.png" format="PNG"></inlinegraphic></link>
</para>
</section>
diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
index 9370c06798..6b589bcc9e 100644
--- a/docs/tools/widgets.c
+++ b/docs/tools/widgets.c
@@ -1589,6 +1589,57 @@ create_expander (void)
return new_widget_info ("expander", widget, SMALL);
}
+static void
+mapped_cb (GtkWidget *widget)
+{
+ gtk_widget_child_focus (widget, GTK_DIR_RIGHT);
+}
+
+static WidgetInfo *
+create_menu_bar (void)
+{
+ GtkWidget *widget;
+ GtkWidget *vbox;
+ GMenu *menu, *menu1;
+ GMenuItem *item;
+
+ menu = g_menu_new ();
+ menu1 = g_menu_new ();
+ item = g_menu_item_new ("Item", "action");
+ g_menu_append_item (menu1, item);
+ g_menu_append_submenu (menu, "File", G_MENU_MODEL (menu1));
+ g_object_unref (item);
+ g_object_unref (menu1);
+ menu1 = g_menu_new ();
+ item = g_menu_item_new ("Item", "action");
+ g_menu_append_item (menu1, item);
+ g_menu_append_submenu (menu, "Edit", G_MENU_MODEL (menu1));
+ g_object_unref (item);
+ g_object_unref (menu1);
+ menu1 = g_menu_new ();
+ item = g_menu_item_new ("Item", "action");
+ g_menu_append_item (menu1, item);
+ g_menu_append_submenu (menu, "View", G_MENU_MODEL (menu1));
+ g_object_unref (item);
+ g_object_unref (menu1);
+
+ widget = gtk_popover_menu_bar_new_from_model (G_MENU_MODEL (menu));
+
+ g_object_unref (menu);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
+ gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
+ gtk_box_append (GTK_BOX (vbox), widget);
+ gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Menu Bar"));
+
+ add_margin (vbox);
+
+ g_signal_connect (widget, "map", G_CALLBACK (mapped_cb), NULL);
+
+ return new_widget_info ("menubar", vbox, SMALL);
+}
+
GList *
get_all_widgets (void)
{
@@ -1658,6 +1709,7 @@ get_all_widgets (void)
retval = g_list_prepend (retval, create_calendar ());
retval = g_list_prepend (retval, create_emojichooser ());
retval = g_list_prepend (retval, create_expander ());
+ retval = g_list_prepend (retval, create_menu_bar ());
return retval;
}