container_class->child_type = gtk_wrap_box_child_type;
container_class->set_child_property = gtk_wrap_box_set_child_property;
container_class->get_child_property = gtk_wrap_box_get_child_property;
+ gtk_container_class_handle_border_width (container_class);
/* GObjectClass properties */
g_object_class_override_property (gobject_class, PROP_ORIENTATION, "orientation");
{
GtkWrapBox *box = GTK_WRAP_BOX (widget);
GtkWrapBoxPrivate *priv = box->priv;
- guint border_width;
gint avail_size, avail_other_size, min_items, item_spacing, line_spacing;
gtk_widget_set_allocation (widget, allocation);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
min_items = MAX (1, priv->minimum_line_children);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- avail_size = allocation->width - border_width * 2;
- avail_other_size = allocation->height - border_width * 2;
+ avail_size = allocation->width;
+ avail_other_size = allocation->height;
item_spacing = priv->horizontal_spacing;
line_spacing = priv->vertical_spacing;
}
else /* GTK_ORIENTATION_VERTICAL */
{
- avail_size = allocation->height - border_width * 2;
- avail_other_size = allocation->width - border_width * 2;
+ avail_size = allocation->height;
+ avail_other_size = allocation->width;
item_spacing = priv->vertical_spacing;
line_spacing = priv->horizontal_spacing;
}
extra_extra = extra_pixels % line_length;
}
- line_offset = item_offset = border_width;
+ line_offset = item_offset = 0;
/* prepend extra space to item_offset for SPREAD_END */
if (priv->spreading == GTK_WRAP_BOX_SPREAD_END)
line_count++;
- item_offset = border_width;
+ item_offset = 0;
if (priv->spreading == GTK_WRAP_BOX_SPREAD_END)
{
sizes = (GtkRequestedSize *)array->data;
avail_other_size = gtk_distribute_natural_allocation (avail_other_size, array->len, sizes);
- for (line_offset = border_width, line_count = 0; line_count < array->len; line_count++)
+ for (line_offset = 0, line_count = 0; line_count < array->len; line_count++)
{
AllocatedLine *line = (AllocatedLine *)sizes[line_count].data;
GArray *line_array = line->requested;
gint extra_extra = 0;
/* Set line start offset */
- item_offset = border_width;
+ item_offset = 0;
if (priv->spreading == GTK_WRAP_BOX_SPREAD_END)
item_offset += line->extra_pixels;
{
GtkWrapBox *box = GTK_WRAP_BOX (widget);
GtkWrapBoxPrivate *priv = box->priv;
- guint border_width;
gint min_item_width, nat_item_width;
gint min_items, nat_items;
gint min_width, nat_width;
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- min_width = nat_width = border_width * 2;
+ min_width = nat_width = 0;
if (priv->mode == GTK_WRAP_ALLOCATE_FREE)
{
{
GtkWrapBox *box = GTK_WRAP_BOX (widget);
GtkWrapBoxPrivate *priv = box->priv;
- guint border_width;
gint min_item_height, nat_item_height;
gint min_items, nat_items;
gint min_height, nat_height;
}
else /* GTK_ORIENTATION_VERTICAL */
{
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- min_height = nat_height = border_width * 2;
+ min_height = nat_height = 0;
if (priv->mode == GTK_WRAP_ALLOCATE_FREE)
{
{
GtkWrapBox *box = GTK_WRAP_BOX (widget);
GtkWrapBoxPrivate *priv = box->priv;
- guint border_width;
gint min_item_width, nat_item_width;
gint min_items;
gint min_height, nat_height;
/* Make sure its no smaller than the minimum */
GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, &min_width, NULL);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
avail_size = MAX (width, min_width);
- avail_size -= border_width * 2;
if (priv->mode == GTK_WRAP_ALLOCATE_ALIGNED ||
priv->mode == GTK_WRAP_ALLOCATE_HOMOGENEOUS)
}
}
}
-
- min_height += border_width * 2;
- nat_height += border_width * 2;
}
else /* GTK_ORIENTATION_VERTICAL */
{
{
GtkWrapBox *box = GTK_WRAP_BOX (widget);
GtkWrapBoxPrivate *priv = box->priv;
- guint border_width;
gint min_item_height, nat_item_height;
gint min_items;
gint min_width, nat_width;
/* Make sure its no smaller than the minimum */
GTK_SIZE_REQUEST_GET_IFACE (widget)->get_height (widget, &min_height, NULL);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
avail_size = MAX (height, min_height);
- avail_size -= border_width * 2;
if (priv->mode == GTK_WRAP_ALLOCATE_ALIGNED ||
priv->mode == GTK_WRAP_ALLOCATE_HOMOGENEOUS)
}
}
}
-
- min_width += border_width * 2;
- nat_width += border_width * 2;
}
if (minimum_width)