diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-05-12 14:32:08 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-05-12 16:53:23 +0200 |
commit | b5c21b95e4b9801902ef9ed3464d09d70d7d1dcf (patch) | |
tree | acc8f647ad4780cdabc91d40f06c3344d6ea1c14 /vcl/inc/unx | |
parent | 59ab855cdac009ea3b52fbdbabf110658e89c16d (diff) |
gtk4: add widget_get_first_child to wrap gtk_widget_get_first_child
and equivalent gtk3 calls
Change-Id: Iab6801466d6677ae5a7419470ce3bb32e16e68ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115486
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/inc/unx')
-rw-r--r-- | vcl/inc/unx/gtk/gtkdata.hxx | 15 |
1 files changed, 14 insertions, 1 deletions
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<GtkWidget*>(pChild->data) : nullptr; + g_list_free(pChildren); + return pRet; +#endif +} + class GtkSalTimer final : public SalTimer { struct SalGtkTimeoutSource *m_pTimeout; |