widget: Add new allocation accessors
This commit is contained in:
committed by
Matthias Clasen
parent
15cacf485a
commit
b17d998eb5
@@ -13528,6 +13528,57 @@ gtk_widget_get_allocation (GtkWidget *widget,
|
||||
*allocation = priv->allocation;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_widget_get_outer_allocation (GtkWidget *widget,
|
||||
GdkRectangle *allocation)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
GtkBorder margin;
|
||||
GtkCssStyle *style;
|
||||
|
||||
style = gtk_css_node_get_style (priv->cssnode);
|
||||
get_box_margin (style, &margin);
|
||||
|
||||
*allocation = priv->allocation;
|
||||
|
||||
allocation->x += margin.left;
|
||||
allocation->y += margin.top;
|
||||
allocation->width -= margin.left + margin.right;
|
||||
allocation->height -= margin.top + margin.bottom;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_widget_get_own_allocation (GtkWidget *widget,
|
||||
GdkRectangle *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->x = -padding.left - border.left;
|
||||
allocation->y = -padding.top - border.top;
|
||||
allocation->width = priv->allocation.width - margin.left - margin.right;
|
||||
allocation->height = priv->allocation.height -margin.top - margin.bottom;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_widget_get_content_size (GtkWidget *widget,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
GtkAllocation alloc;
|
||||
|
||||
gtk_widget_get_content_allocation (widget, &alloc);
|
||||
|
||||
*width = alloc.width;
|
||||
*height = alloc.height;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_widget_get_content_allocation (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
|
||||
@@ -324,7 +324,13 @@ void gtk_widget_get_border_allocation (GtkWidget *wi
|
||||
GtkAllocation *allocation);
|
||||
void gtk_widget_get_margin_allocation (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
void gtk_widget_get_outer_allocation (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
void gtk_widget_get_own_allocation (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
void gtk_widget_get_content_size (GtkWidget *widget,
|
||||
int *width,
|
||||
int *height);
|
||||
|
||||
GtkWidget * gtk_widget_common_ancestor (GtkWidget *widget_a,
|
||||
GtkWidget *widget_b);
|
||||
|
||||
Reference in New Issue
Block a user