summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/reference/gtk/gtk4-sections.txt2
-rw-r--r--gtk/gtkmenubutton.c31
-rw-r--r--gtk/gtkmenubutton.h6
3 files changed, 39 insertions, 0 deletions
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index ba5ff18e37..338e80e1b9 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -1855,6 +1855,8 @@ gtk_menu_button_set_label
gtk_menu_button_get_label
gtk_menu_button_set_relief
gtk_menu_button_get_relief
+gtk_menu_button_popup
+gtk_menu_button_popdown
<SUBSECTION Standard>
GTK_TYPE_MENU_BUTTON
GTK_MENU_BUTTON
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index eddef5584d..80ad5affd5 100644
--- a/gtk/gtkmenubutton.c
+++ b/gtk/gtkmenubutton.c
@@ -1369,3 +1369,34 @@ gtk_menu_button_get_relief (GtkMenuButton *menu_button)
return gtk_button_get_relief (GTK_BUTTON (priv->button));
}
+/**
+ * gtk_menu_button_popup:
+ * @menu_button: a #GtkMenuButton
+ *
+ * Pop up the menu.
+ */
+void
+gtk_menu_button_popup (GtkMenuButton *menu_button)
+{
+ GtkMenuButtonPrivate *priv = gtk_menu_button_get_instance_private (menu_button);
+
+ g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button), TRUE);
+}
+
+/**
+ * gtk_menu_button_popdown:
+ * @menu_button: a #GtkMenuButton
+ *
+ * Dismiss the menu.
+ */
+void
+gtk_menu_button_popdown (GtkMenuButton *menu_button)
+{
+ GtkMenuButtonPrivate *priv = gtk_menu_button_get_instance_private (menu_button);
+
+ g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button), FALSE);
+}
diff --git a/gtk/gtkmenubutton.h b/gtk/gtkmenubutton.h
index c94dd49376..28d9612cdc 100644
--- a/gtk/gtkmenubutton.h
+++ b/gtk/gtkmenubutton.h
@@ -118,6 +118,12 @@ void gtk_menu_button_set_relief (GtkMenuButton *menu_button,
GDK_AVAILABLE_IN_ALL
GtkReliefStyle gtk_menu_button_get_relief (GtkMenuButton *menu_button);
+GDK_AVAILABLE_IN_ALL
+void gtk_menu_button_popup (GtkMenuButton *menu_button);
+GDK_AVAILABLE_IN_ALL
+void gtk_menu_button_popdown (GtkMenuButton *menu_button);
+
+
G_END_DECLS
#endif /* __GTK_MENU_BUTTON_H__ */