[gtk+/wip/baedert/drawing: 116/262] widget: Add private get_border_allocation



commit da8471947fc4e4adbca36b8151b9656d0c55375b
Author: Timm Bäder <mail baedert org>
Date:   Fri May 5 12:54:24 2017 +0200

    widget: Add private get_border_allocation

 gtk/gtkwidget.c        |   22 ++++++++++++++++++++++
 gtk/gtkwidgetprivate.h |    2 ++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index fa947fc..f7e0285 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -13669,6 +13669,28 @@ gtk_widget_get_content_allocation (GtkWidget     *widget,
                         margin.bottom + border.bottom + padding.bottom;
 }
 
+void
+gtk_widget_get_border_allocation (GtkWidget     *widget,
+                                  GtkAllocation *allocation)
+{
+  GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
+  GtkBorder margin, border;
+  GtkCssStyle *style;
+
+  style = gtk_css_node_get_style (priv->cssnode);
+  get_box_margin (style, &margin);
+  get_box_border (style, &border);
+
+  *allocation = priv->allocation;
+
+  allocation->x += margin.left + border.left;
+  allocation->y += margin.top + border.top;
+  allocation->width -= margin.left + border.left +
+                       margin.right + border.right;
+  allocation->height -= margin.top + border.top +
+                        margin.bottom + border.bottom;
+}
+
 /**
  * gtk_widget_set_allocation:
  * @widget: a #GtkWidget
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 404969b..e9acd9a 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -320,6 +320,8 @@ gboolean          gtk_widget_focus_move                    (GtkWidget        *wi
                                                             GPtrArray        *focus_order);
 void              gtk_widget_get_content_allocation        (GtkWidget        *widget,
                                                             GtkAllocation    *allocation);
+void              gtk_widget_get_border_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]