summaryrefslogtreecommitdiff
path: root/gtk/gtkmenubutton.h
diff options
context:
space:
mode:
authorChristopher Davis <christopherdavis@gnome.org>2023-02-12 16:14:43 -0500
committerChristopher Davis <christopherdavis@gnome.org>2023-02-12 16:47:59 -0500
commitff45145eac76255a0d3d95063c7f053302611471 (patch)
tree3699817c7fbf6a54fd03bdfd8c53143226f7353e /gtk/gtkmenubutton.h
parent84b5e94ffdfbb8449dc4955b8e865ad44627a40c (diff)
downloadgtk+-ff45145eac76255a0d3d95063c7f053302611471.tar.gz
menubutton: Add `active` property and getter/setter
GtkMenuButton currently does not provide a way to tell if it's open programmatically. The existing methods, `popup()` and `popdown()`, do not expose any state to callers. If someone wanted to know whether or not a menubutton was open, they needed the popover. Given that GtkMenuButton can manage the popovers itself, that's not always an option for app developers. This commit adds the `active` property and associated methods, where `gtk_menu_button_set_active ()` replaces both `gtk_menu_popup ()` and `gtk_menu_popdown ()`. This addition also mirrors changes in other places, Such as `GtkWidget:visible` vs `show()`/`hide()`.
Diffstat (limited to 'gtk/gtkmenubutton.h')
-rw-r--r--gtk/gtkmenubutton.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gtk/gtkmenubutton.h b/gtk/gtkmenubutton.h
index 412f43ca3b..87d87976b2 100644
--- a/gtk/gtkmenubutton.h
+++ b/gtk/gtkmenubutton.h
@@ -127,6 +127,12 @@ void gtk_menu_button_set_child (GtkMenuButton *menu_button,
GDK_AVAILABLE_IN_4_6
GtkWidget * gtk_menu_button_get_child (GtkMenuButton *menu_button);
+GDK_AVAILABLE_IN_4_10
+void gtk_menu_button_set_active (GtkMenuButton *menu_button,
+ gboolean active);
+GDK_AVAILABLE_IN_4_10
+gboolean gtk_menu_button_get_active (GtkMenuButton *menu_button);
+
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkMenuButton, g_object_unref)
G_END_DECLS