[libadwaita] gizmo: Add setters for setting allocate etc functions



commit 6238f9cc65055982bbae617c05fb42fda81decd3
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Thu Apr 21 23:32:22 2022 +0400

    gizmo: Add setters for setting allocate etc functions

 src/adw-gizmo-private.h | 13 +++++++++++++
 src/adw-gizmo.c         | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+)
---
diff --git a/src/adw-gizmo-private.h b/src/adw-gizmo-private.h
index ce667c15..f9dd638a 100644
--- a/src/adw-gizmo-private.h
+++ b/src/adw-gizmo-private.h
@@ -58,4 +58,17 @@ GtkWidget *adw_gizmo_new_with_role (const char            *css_name,
                                     AdwGizmoFocusFunc      focus_func,
                                     AdwGizmoGrabFocusFunc  grab_focus_func) G_GNUC_WARN_UNUSED_RESULT;
 
+void adw_gizmo_set_measure_func    (AdwGizmo              *self,
+                                    AdwGizmoMeasureFunc    measure_func);
+void adw_gizmo_set_allocate_func   (AdwGizmo              *self,
+                                    AdwGizmoAllocateFunc   allocate_func);
+void adw_gizmo_set_snapshot_func   (AdwGizmo              *self,
+                                    AdwGizmoSnapshotFunc   snapshot_func);
+void adw_gizmo_set_contains_func   (AdwGizmo              *self,
+                                    AdwGizmoContainsFunc   contains_func);
+void adw_gizmo_set_focus_func      (AdwGizmo              *self,
+                                    AdwGizmoFocusFunc      focus_func);
+void adw_gizmo_set_grab_focus_func (AdwGizmo              *self,
+                                    AdwGizmoGrabFocusFunc  grab_focus_func);
+
 G_END_DECLS
diff --git a/src/adw-gizmo.c b/src/adw-gizmo.c
index cdebb73e..df1695e0 100644
--- a/src/adw-gizmo.c
+++ b/src/adw-gizmo.c
@@ -189,3 +189,53 @@ adw_gizmo_new_with_role (const char            *css_name,
 
   return GTK_WIDGET (gizmo);
 }
+
+void
+adw_gizmo_set_measure_func (AdwGizmo            *self,
+                            AdwGizmoMeasureFunc  measure_func)
+{
+  self->measure_func = measure_func;
+
+  gtk_widget_queue_resize (GTK_WIDGET (self));
+}
+
+void
+adw_gizmo_set_allocate_func (AdwGizmo             *self,
+                             AdwGizmoAllocateFunc  allocate_func)
+{
+  self->allocate_func = allocate_func;
+
+  gtk_widget_queue_allocate (GTK_WIDGET (self));
+}
+
+void
+adw_gizmo_set_snapshot_func (AdwGizmo             *self,
+                             AdwGizmoSnapshotFunc  snapshot_func)
+{
+  self->snapshot_func = snapshot_func;
+
+  gtk_widget_queue_draw (GTK_WIDGET (self));
+}
+
+void
+adw_gizmo_set_contains_func (AdwGizmo             *self,
+                             AdwGizmoContainsFunc  contains_func)
+{
+  self->contains_func = contains_func;
+
+  gtk_widget_queue_resize (GTK_WIDGET (self));
+}
+
+void
+adw_gizmo_set_focus_func (AdwGizmo          *self,
+                          AdwGizmoFocusFunc  focus_func)
+{
+  self->focus_func = focus_func;
+}
+
+void
+adw_gizmo_set_grab_focus_func (AdwGizmo              *self,
+                               AdwGizmoGrabFocusFunc  grab_focus_func)
+{
+  self->grab_focus_func = grab_focus_func;
+}


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