[gtk+/wip/baedert/drawing: 197/301] widget: Add private get_margin_allocation
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing: 197/301] widget: Add private get_margin_allocation
- Date: Fri, 26 May 2017 10:50:31 +0000 (UTC)
commit 75b2719e7d1b13ec18cf5db863405c0b8543cb99
Author: Timm Bäder <mail baedert org>
Date: Fri May 5 18:24:52 2017 +0200
widget: Add private get_margin_allocation
gtk/gtkwidget.c | 20 ++++++++++++++++++++
gtk/gtkwidgetprivate.h | 3 +++
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 2ebb922..e69c98c 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -13672,6 +13672,26 @@ gtk_widget_get_border_allocation (GtkWidget *widget,
margin.bottom + border.bottom;
}
+void
+gtk_widget_get_margin_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;
+ allocation->y += margin.top;
+ allocation->width -= margin.left + margin.right;
+ allocation->height -= margin.top + margin.bottom;
+}
+
/**
* gtk_widget_set_allocation:
* @widget: a #GtkWidget
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index e9acd9a..6702c86 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -322,6 +322,9 @@ void gtk_widget_get_content_allocation (GtkWidget *wi
GtkAllocation *allocation);
void gtk_widget_get_border_allocation (GtkWidget *widget,
GtkAllocation *allocation);
+void gtk_widget_get_margin_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]