From b5c21b95e4b9801902ef9ed3464d09d70d7d1dcf Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 12 May 2021 14:32:08 +0100 Subject: gtk4: add widget_get_first_child to wrap gtk_widget_get_first_child MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and equivalent gtk3 calls Change-Id: Iab6801466d6677ae5a7419470ce3bb32e16e68ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115486 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/inc/unx/gtk/gtkdata.hxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'vcl/inc/unx') diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index d12138298b43..92f8f28c0b6d 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -77,7 +77,7 @@ inline GtkWidget* widget_get_root(GtkWidget* pWidget) #endif } -inline const char * image_get_icon_name(GtkImage *pImage) +inline const char* image_get_icon_name(GtkImage *pImage) { #if GTK_CHECK_VERSION(4, 0, 0) return gtk_image_get_icon_name(pImage); @@ -88,6 +88,19 @@ inline const char * image_get_icon_name(GtkImage *pImage) #endif } +inline GtkWidget* widget_get_first_child(GtkWidget *pWidget) +{ +#if GTK_CHECK_VERSION(4, 0, 0) + return gtk_widget_get_first_child(pWidget); +#else + GList* pChildren = gtk_container_get_children(GTK_CONTAINER(pWidget)); + GList* pChild = g_list_first(pChildren); + GtkWidget* pRet = pChild ? static_cast(pChild->data) : nullptr; + g_list_free(pChildren); + return pRet; +#endif +} + class GtkSalTimer final : public SalTimer { struct SalGtkTimeoutSource *m_pTimeout; -- cgit