[gtk+/wip/baedert/drawing: 63/241] widget: Add private gtk_widget_get_content_allocation



commit 19893f18631917b4e62499f5df4ad96608351e7b
Author: Timm Bäder <mail baedert org>
Date:   Thu May 4 16:04:49 2017 +0200

    widget: Add private gtk_widget_get_content_allocation

 gtk/gtkwidget.c        |   23 +++++++++++++++++++++++
 gtk/gtkwidgetprivate.h |    4 ++++
 2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 028be43..5d7f9ab 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -13646,6 +13646,29 @@ gtk_widget_get_allocation (GtkWidget     *widget,
   *allocation = priv->allocation;
 }
 
+void
+gtk_widget_get_content_allocation (GtkWidget     *widget,
+                                   GtkAllocation *allocation)
+{
+  GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
+  GtkBorder margin, border, padding;
+  GtkCssStyle *style;
+
+  style = gtk_css_node_get_style (priv->cssnode);
+  get_box_margin (style, &margin);
+  get_box_border (style, &border);
+  get_box_padding (style, &padding);
+
+  *allocation = priv->allocation;
+
+  allocation->x += margin.left + border.left + padding.left;
+  allocation->y += margin.top + border.top + padding.top;
+  allocation->width -= margin.left + border.left + padding.left +
+                       margin.right + border.right + padding.right;
+  allocation->height -= margin.top + border.top + padding.top +
+                        margin.bottom + border.bottom + padding.bottom;
+}
+
 /**
  * gtk_widget_set_allocation:
  * @widget: a #GtkWidget
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 5211b40..404969b 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -94,6 +94,8 @@ struct _GtkWidgetPrivate
   guint   halign              : 4;
   guint   valign              : 4;
 
+  guint clip_set : 1;
+
   guint8 alpha;
   guint8 user_alpha;
 
@@ -316,6 +318,8 @@ void              gtk_widget_focus_sort                    (GtkWidget        *wi
 gboolean          gtk_widget_focus_move                    (GtkWidget        *widget,
                                                             GtkDirectionType  direction,
                                                             GPtrArray        *focus_order);
+void              gtk_widget_get_content_allocation        (GtkWidget        *widget,
+                                                            GtkAllocation    *allocation);
 
 GtkWidget *       gtk_widget_common_ancestor               (GtkWidget *widget_a,
                                                             GtkWidget *widget_b);


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