[gtk/wip/otte/canvas: 22/36] canvasbox: Add getters
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/canvas: 22/36] canvasbox: Add getters
- Date: Tue, 5 Jul 2022 05:41:42 +0000 (UTC)
commit 35534b7143f5203cec7ee8d9bd22032ea5c0580e
Author: Benjamin Otte <otte redhat com>
Date: Wed Jun 29 01:08:20 2022 +0200
canvasbox: Add getters
Since the box is no longer specialized, it's easy to query it.
Make that happen.
gtk/gtkcanvasbox.c | 28 ++++++++++++++++++++++++++++
gtk/gtkcanvasbox.h | 9 +++++++++
2 files changed, 37 insertions(+)
---
diff --git a/gtk/gtkcanvasbox.c b/gtk/gtkcanvasbox.c
index 810ee610f6..48b31fdc92 100644
--- a/gtk/gtkcanvasbox.c
+++ b/gtk/gtkcanvasbox.c
@@ -160,3 +160,31 @@ gtk_canvas_box_eval (const GtkCanvasBox *self,
return FALSE;
}
+const GtkCanvasPoint *
+gtk_canvas_box_get_point (const GtkCanvasBox *self)
+{
+ g_return_val_if_fail (self != NULL, NULL);
+
+ return &self->point;
+}
+
+const GtkCanvasSize *
+gtk_canvas_box_get_size (const GtkCanvasBox *self)
+{
+ g_return_val_if_fail (self != NULL, NULL);
+
+ return &self->size;
+}
+
+void
+gtk_canvas_box_get_origin (const GtkCanvasBox *self,
+ float *x,
+ float *y)
+{
+ g_return_if_fail (self != NULL);
+
+ if (x)
+ *x = self->origin_x;
+ if (y)
+ *y = self->origin_y;
+}
diff --git a/gtk/gtkcanvasbox.h b/gtk/gtkcanvasbox.h
index 4211ca323c..0fede6dcca 100644
--- a/gtk/gtkcanvasbox.h
+++ b/gtk/gtkcanvasbox.h
@@ -40,6 +40,15 @@ GtkCanvasBox * gtk_canvas_box_copy (const GtkCanvasBo
GDK_AVAILABLE_IN_ALL
void gtk_canvas_box_free (GtkCanvasBox *self);
+GDK_AVAILABLE_IN_ALL
+const GtkCanvasPoint * gtk_canvas_box_get_point (const GtkCanvasBox *self) G_GNUC_PURE;
+GDK_AVAILABLE_IN_ALL
+const GtkCanvasSize * gtk_canvas_box_get_size (const GtkCanvasBox *self) G_GNUC_PURE;
+GDK_AVAILABLE_IN_ALL
+void gtk_canvas_box_get_origin (const GtkCanvasBox *self,
+ float *x,
+ float *y);
+
GDK_AVAILABLE_IN_ALL
gboolean gtk_canvas_box_eval (const GtkCanvasBox *self,
graphene_rect_t *rect)
G_GNUC_WARN_UNUSED_RESULT;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]