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




commit 7869f184c730b9536a4cd8d581f9b839c236a9fa
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]