[gtk+/wip/cosimoc/range-gadget: 21/33] gadget: add API to get various area boxes



commit f36628d5b78db5124243782b7637f1b360422ec2
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Feb 24 14:21:10 2016 -0800

    gadget: add API to get various area boxes
    
    Compared to the function returning the allocation, these will return the
    box in gadget coordinates.

 gtk/gtkcssgadget.c        |   51 +++++++++++++++++++++++++++++++++++++++++++++
 gtk/gtkcssgadgetprivate.h |    6 +++++
 2 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssgadget.c b/gtk/gtkcssgadget.c
index af7afb5..1c68a7a 100644
--- a/gtk/gtkcssgadget.c
+++ b/gtk/gtkcssgadget.c
@@ -956,6 +956,57 @@ gtk_css_gadget_queue_draw (GtkCssGadget *gadget)
   gtk_widget_queue_draw (gtk_css_gadget_get_owner (gadget));
 }
 
+/**
+ * gtk_css_gadget_get_margin_box:
+ * @gadget: a #GtkCssGadget
+ * @box: (out): Return location for gadget's the margin box
+ *
+ * Returns the margin box of the gadget. The box coordinates are relative to
+ *   the gadget origin. Compare with gtk_css_gadget_get_margin_allocation(),
+ *   which returns the margin box in the widget allocation coordinates.
+ */
+void
+gtk_css_gadget_get_margin_box (GtkCssGadget  *gadget,
+                               GtkAllocation *box)
+{
+  gtk_css_gadget_get_margin_allocation (gadget, box, NULL);
+  shift_allocation (gadget, box);
+}
+
+/**
+ * gtk_css_gadget_get_border_box:
+ * @gadget: a #GtkCssGadget
+ * @box: (out): Return location for gadget's the border box
+ *
+ * Returns the border box of the gadget. The box coordinates are relative to
+ *   the gadget origin. Compare with gtk_css_gadget_get_border_allocation(),
+ *   which returns the border box in the widget allocation coordinates.
+ */
+void
+gtk_css_gadget_get_border_box (GtkCssGadget  *gadget,
+                               GtkAllocation *box)
+{
+  gtk_css_gadget_get_border_allocation (gadget, box, NULL);
+  shift_allocation (gadget, box);
+}
+
+/**
+ * gtk_css_gadget_get_content_box:
+ * @gadget: a #GtkCssGadget
+ * @box: (out): Return location for gadget's the content box
+ *
+ * Returns the content box of the gadget. The box coordinates are relative to
+ *   the gadget origin. Compare with gtk_css_gadget_get_content_allocation(),
+ *   which returns the content box in the widget allocation coordinates.
+ */
+void
+gtk_css_gadget_get_content_box (GtkCssGadget  *gadget,
+                                GtkAllocation *box)
+{
+  gtk_css_gadget_get_content_allocation (gadget, box, NULL);
+  shift_allocation (gadget, box);
+}
+
 void
 gtk_css_gadget_get_margin_allocation (GtkCssGadget  *gadget,
                                       GtkAllocation *allocation,
diff --git a/gtk/gtkcssgadgetprivate.h b/gtk/gtkcssgadgetprivate.h
index 6578135..fa3c409 100644
--- a/gtk/gtkcssgadgetprivate.h
+++ b/gtk/gtkcssgadgetprivate.h
@@ -93,6 +93,12 @@ gboolean        gtk_css_gadget_border_box_contains_point (GtkCssGadget
 gboolean        gtk_css_gadget_content_box_contains_point (GtkCssGadget         *gadget,
                                                            int                   x,
                                                            int                   y);
+void            gtk_css_gadget_get_margin_box           (GtkCssGadget           *gadget,
+                                                         GtkAllocation          *box);
+void            gtk_css_gadget_get_border_box           (GtkCssGadget           *gadget,
+                                                         GtkAllocation          *box);
+void            gtk_css_gadget_get_content_box          (GtkCssGadget           *gadget,
+                                                         GtkAllocation          *box);
 
 void            gtk_css_gadget_add_class                (GtkCssGadget           *gadget,
                                                          const char             *name);


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