[libadwaita/wip/exalm/a11y-fixes: 4/11] gizmo: Copy new_with_role() from GTK




commit 0d29d5dccec0314f11fc659fd8f1e0af09a4ca93
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Dec 27 17:44:57 2021 +0500

    gizmo: Copy new_with_role() from GTK

 src/adw-gizmo-private.h |  9 +++++++++
 src/adw-gizmo.c         | 25 +++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
---
diff --git a/src/adw-gizmo-private.h b/src/adw-gizmo-private.h
index 8ccc818b..ec95b2a9 100644
--- a/src/adw-gizmo-private.h
+++ b/src/adw-gizmo-private.h
@@ -49,4 +49,13 @@ GtkWidget *adw_gizmo_new (const char            *css_name,
                           AdwGizmoFocusFunc      focus_func,
                           AdwGizmoGrabFocusFunc  grab_focus_func) G_GNUC_WARN_UNUSED_RESULT;
 
+GtkWidget *adw_gizmo_new_with_role (const char            *css_name,
+                                    GtkAccessibleRole      role,
+                                    AdwGizmoMeasureFunc    measure_func,
+                                    AdwGizmoAllocateFunc   allocate_func,
+                                    AdwGizmoSnapshotFunc   snapshot_func,
+                                    AdwGizmoContainsFunc   contains_func,
+                                    AdwGizmoFocusFunc      focus_func,
+                                    AdwGizmoGrabFocusFunc  grab_focus_func);
+
 G_END_DECLS
diff --git a/src/adw-gizmo.c b/src/adw-gizmo.c
index caa8a060..cdebb73e 100644
--- a/src/adw-gizmo.c
+++ b/src/adw-gizmo.c
@@ -164,3 +164,28 @@ adw_gizmo_new (const char            *css_name,
 
   return GTK_WIDGET (gizmo);
 }
+
+GtkWidget *
+adw_gizmo_new_with_role (const char            *css_name,
+                         GtkAccessibleRole      role,
+                         AdwGizmoMeasureFunc    measure_func,
+                         AdwGizmoAllocateFunc   allocate_func,
+                         AdwGizmoSnapshotFunc   snapshot_func,
+                         AdwGizmoContainsFunc   contains_func,
+                         AdwGizmoFocusFunc      focus_func,
+                         AdwGizmoGrabFocusFunc  grab_focus_func)
+{
+  AdwGizmo *gizmo = ADW_GIZMO (g_object_new (ADW_TYPE_GIZMO,
+                                             "css-name", css_name,
+                                             "accessible-role", role,
+                                             NULL));
+
+  gizmo->measure_func  = measure_func;
+  gizmo->allocate_func = allocate_func;
+  gizmo->snapshot_func = snapshot_func;
+  gizmo->contains_func = contains_func;
+  gizmo->focus_func = focus_func;
+  gizmo->grab_focus_func = grab_focus_func;
+
+  return GTK_WIDGET (gizmo);
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]