gtkbox: Move public members to private structure
This commit is contained in:
parent
a46c1eba64
commit
0677bb2785
193
gtk/gtkbox.c
193
gtk/gtkbox.c
@ -99,16 +99,19 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct _GtkBoxPrivate GtkBoxPrivate;
|
struct _GtkBoxPriv
|
||||||
|
|
||||||
struct _GtkBoxPrivate
|
|
||||||
{
|
{
|
||||||
GtkOrientation orientation;
|
GtkOrientation orientation;
|
||||||
guint default_expand : 1;
|
|
||||||
guint spacing_set : 1;
|
GList *children;
|
||||||
|
|
||||||
|
gint16 spacing;
|
||||||
|
|
||||||
|
guint default_expand : 1;
|
||||||
|
guint homogeneous : 1;
|
||||||
|
guint spacing_set : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GTK_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_BOX, GtkBoxPrivate))
|
|
||||||
|
|
||||||
typedef struct _GtkBoxDesiredSizes GtkBoxDesiredSizes;
|
typedef struct _GtkBoxDesiredSizes GtkBoxDesiredSizes;
|
||||||
typedef struct _GtkBoxSpreading GtkBoxSpreading;
|
typedef struct _GtkBoxSpreading GtkBoxSpreading;
|
||||||
@ -280,23 +283,28 @@ gtk_box_class_init (GtkBoxClass *class)
|
|||||||
-1, G_MAXINT, 0,
|
-1, G_MAXINT, 0,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
g_type_class_add_private (object_class, sizeof (GtkBoxPrivate));
|
g_type_class_add_private (object_class, sizeof (GtkBoxPriv));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_box_init (GtkBox *box)
|
gtk_box_init (GtkBox *box)
|
||||||
{
|
{
|
||||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
GtkBoxPriv *private;
|
||||||
|
|
||||||
|
box->priv = G_TYPE_INSTANCE_GET_PRIVATE (box,
|
||||||
|
GTK_TYPE_BOX,
|
||||||
|
GtkBoxPriv);
|
||||||
|
private = box->priv;
|
||||||
|
|
||||||
gtk_widget_set_has_window (GTK_WIDGET (box), FALSE);
|
gtk_widget_set_has_window (GTK_WIDGET (box), FALSE);
|
||||||
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (box), FALSE);
|
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (box), FALSE);
|
||||||
|
|
||||||
box->children = NULL;
|
|
||||||
box->spacing = 0;
|
|
||||||
box->homogeneous = FALSE;
|
|
||||||
|
|
||||||
private->orientation = GTK_ORIENTATION_HORIZONTAL;
|
private->orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||||
|
private->children = NULL;
|
||||||
|
|
||||||
private->default_expand = FALSE;
|
private->default_expand = FALSE;
|
||||||
|
private->homogeneous = FALSE;
|
||||||
|
private->spacing = 0;
|
||||||
private->spacing_set = FALSE;
|
private->spacing_set = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +315,7 @@ gtk_box_set_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkBox *box = GTK_BOX (object);
|
GtkBox *box = GTK_BOX (object);
|
||||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
GtkBoxPriv *private = box->priv;
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@ -334,7 +342,7 @@ gtk_box_get_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkBox *box = GTK_BOX (object);
|
GtkBox *box = GTK_BOX (object);
|
||||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
GtkBoxPriv *private = box->priv;
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@ -342,10 +350,10 @@ gtk_box_get_property (GObject *object,
|
|||||||
g_value_set_enum (value, private->orientation);
|
g_value_set_enum (value, private->orientation);
|
||||||
break;
|
break;
|
||||||
case PROP_SPACING:
|
case PROP_SPACING:
|
||||||
g_value_set_int (value, box->spacing);
|
g_value_set_int (value, private->spacing);
|
||||||
break;
|
break;
|
||||||
case PROP_HOMOGENEOUS:
|
case PROP_HOMOGENEOUS:
|
||||||
g_value_set_boolean (value, box->homogeneous);
|
g_value_set_boolean (value, private->homogeneous);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -355,14 +363,17 @@ gtk_box_get_property (GObject *object,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
count_expand_children (GtkBox *box, gint *visible_children, gint *expand_children)
|
count_expand_children (GtkBox *box,
|
||||||
|
gint *visible_children,
|
||||||
|
gint *expand_children)
|
||||||
{
|
{
|
||||||
|
GtkBoxPriv *private = box->priv;
|
||||||
GList *children;
|
GList *children;
|
||||||
GtkBoxChild *child;
|
GtkBoxChild *child;
|
||||||
|
|
||||||
*visible_children = *expand_children = 0;
|
*visible_children = *expand_children = 0;
|
||||||
|
|
||||||
for (children = box->children; children; children = children->next)
|
for (children = private->children; children; children = children->next)
|
||||||
{
|
{
|
||||||
child = children->data;
|
child = children->data;
|
||||||
|
|
||||||
@ -404,7 +415,7 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
GtkAllocation *allocation)
|
GtkAllocation *allocation)
|
||||||
{
|
{
|
||||||
GtkBox *box = GTK_BOX (widget);
|
GtkBox *box = GTK_BOX (widget);
|
||||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
GtkBoxPriv *private = box->priv;
|
||||||
GtkBoxChild *child;
|
GtkBoxChild *child;
|
||||||
GList *children;
|
GList *children;
|
||||||
gint nvis_children;
|
gint nvis_children;
|
||||||
@ -430,13 +441,13 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
gint child_size;
|
gint child_size;
|
||||||
|
|
||||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
size = allocation->width - border_width * 2 - (nvis_children - 1) * box->spacing;
|
size = allocation->width - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||||
else
|
else
|
||||||
size = allocation->height - border_width * 2 - (nvis_children - 1) * box->spacing;
|
size = allocation->height - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||||
|
|
||||||
/* Retrieve desired size for visible children */
|
/* Retrieve desired size for visible children */
|
||||||
i = 0;
|
i = 0;
|
||||||
children = box->children;
|
children = private->children;
|
||||||
while (children)
|
while (children)
|
||||||
{
|
{
|
||||||
child = children->data;
|
child = children->data;
|
||||||
@ -484,15 +495,15 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (box->homogeneous)
|
if (private->homogeneous)
|
||||||
{
|
{
|
||||||
/* If were homogenous we still need to run the above loop to get the minimum sizes
|
/* If were homogenous we still need to run the above loop to get the minimum sizes
|
||||||
* for children that are not going to fill
|
* for children that are not going to fill
|
||||||
*/
|
*/
|
||||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
size = allocation->width - border_width * 2 - (nvis_children - 1) * box->spacing;
|
size = allocation->width - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||||
else
|
else
|
||||||
size = allocation->height - border_width * 2 - (nvis_children - 1) * box->spacing;
|
size = allocation->height - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||||
|
|
||||||
extra = size / nvis_children;
|
extra = size / nvis_children;
|
||||||
}
|
}
|
||||||
@ -573,7 +584,7 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
children = box->children;
|
children = private->children;
|
||||||
while (children)
|
while (children)
|
||||||
{
|
{
|
||||||
child = children->data;
|
child = children->data;
|
||||||
@ -584,7 +595,7 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
if (child->pack == packing)
|
if (child->pack == packing)
|
||||||
{
|
{
|
||||||
/* Assign the child's size. */
|
/* Assign the child's size. */
|
||||||
if (box->homogeneous)
|
if (private->homogeneous)
|
||||||
{
|
{
|
||||||
if (nvis_children == 1)
|
if (nvis_children == 1)
|
||||||
child_size = size;
|
child_size = size;
|
||||||
@ -626,11 +637,11 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
if (packing == GTK_PACK_START)
|
if (packing == GTK_PACK_START)
|
||||||
{
|
{
|
||||||
x += child_size + box->spacing;
|
x += child_size + private->spacing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x -= child_size + box->spacing;
|
x -= child_size + private->spacing;
|
||||||
|
|
||||||
child_allocation.x -= child_size;
|
child_allocation.x -= child_size;
|
||||||
}
|
}
|
||||||
@ -654,11 +665,11 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
if (packing == GTK_PACK_START)
|
if (packing == GTK_PACK_START)
|
||||||
{
|
{
|
||||||
y += child_size + box->spacing;
|
y += child_size + private->spacing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
y -= child_size + box->spacing;
|
y -= child_size + private->spacing;
|
||||||
|
|
||||||
child_allocation.y -= child_size;
|
child_allocation.y -= child_size;
|
||||||
}
|
}
|
||||||
@ -780,7 +791,7 @@ gtk_box_get_child_property (GtkContainer *container,
|
|||||||
break;
|
break;
|
||||||
case CHILD_PROP_POSITION:
|
case CHILD_PROP_POSITION:
|
||||||
i = 0;
|
i = 0;
|
||||||
for (list = GTK_BOX (container)->children; list; list = list->next)
|
for (list = GTK_BOX (container)->priv->children; list; list = list->next)
|
||||||
{
|
{
|
||||||
GtkBoxChild *child_entry;
|
GtkBoxChild *child_entry;
|
||||||
|
|
||||||
@ -805,6 +816,7 @@ gtk_box_pack (GtkBox *box,
|
|||||||
guint padding,
|
guint padding,
|
||||||
GtkPackType pack_type)
|
GtkPackType pack_type)
|
||||||
{
|
{
|
||||||
|
GtkBoxPriv *private = box->priv;
|
||||||
GtkBoxChild *child_info;
|
GtkBoxChild *child_info;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_BOX (box));
|
g_return_if_fail (GTK_IS_BOX (box));
|
||||||
@ -819,7 +831,7 @@ gtk_box_pack (GtkBox *box,
|
|||||||
child_info->pack = pack_type;
|
child_info->pack = pack_type;
|
||||||
child_info->is_secondary = FALSE;
|
child_info->is_secondary = FALSE;
|
||||||
|
|
||||||
box->children = g_list_append (box->children, child_info);
|
private->children = g_list_append (private->children, child_info);
|
||||||
|
|
||||||
gtk_widget_freeze_child_notify (child);
|
gtk_widget_freeze_child_notify (child);
|
||||||
|
|
||||||
@ -849,7 +861,7 @@ gtk_box_size_request_init (GtkSizeRequestIface *iface)
|
|||||||
static GtkSizeRequestMode
|
static GtkSizeRequestMode
|
||||||
gtk_box_get_request_mode (GtkSizeRequest *widget)
|
gtk_box_get_request_mode (GtkSizeRequest *widget)
|
||||||
{
|
{
|
||||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (widget);
|
GtkBoxPriv *private = GTK_BOX (widget)->priv;
|
||||||
|
|
||||||
return (private->orientation == GTK_ORIENTATION_VERTICAL) ?
|
return (private->orientation == GTK_ORIENTATION_VERTICAL) ?
|
||||||
GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH : GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT;
|
GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH : GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT;
|
||||||
@ -862,21 +874,21 @@ gtk_box_get_size (GtkSizeRequest *widget,
|
|||||||
gint *natural_size)
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
GtkBox *box;
|
GtkBox *box;
|
||||||
GtkBoxPrivate *private;
|
GtkBoxPriv *private;
|
||||||
GList *children;
|
GList *children;
|
||||||
gint nvis_children;
|
gint nvis_children;
|
||||||
gint border_width;
|
gint border_width;
|
||||||
gint minimum, natural;
|
gint minimum, natural;
|
||||||
|
|
||||||
box = GTK_BOX (widget);
|
box = GTK_BOX (widget);
|
||||||
private = GTK_BOX_GET_PRIVATE (box);
|
private = box->priv;
|
||||||
border_width = GTK_CONTAINER (box)->border_width;
|
border_width = GTK_CONTAINER (box)->border_width;
|
||||||
|
|
||||||
minimum = natural = 0;
|
minimum = natural = 0;
|
||||||
|
|
||||||
nvis_children = 0;
|
nvis_children = 0;
|
||||||
|
|
||||||
for (children = box->children; children; children = children->next)
|
for (children = private->children; children; children = children->next)
|
||||||
{
|
{
|
||||||
GtkBoxChild *child = children->data;
|
GtkBoxChild *child = children->data;
|
||||||
|
|
||||||
@ -893,7 +905,7 @@ gtk_box_get_size (GtkSizeRequest *widget,
|
|||||||
|
|
||||||
if (private->orientation == orientation)
|
if (private->orientation == orientation)
|
||||||
{
|
{
|
||||||
if (box->homogeneous)
|
if (private->homogeneous)
|
||||||
{
|
{
|
||||||
gint largest;
|
gint largest;
|
||||||
|
|
||||||
@ -922,13 +934,13 @@ gtk_box_get_size (GtkSizeRequest *widget,
|
|||||||
|
|
||||||
if (nvis_children > 0 && private->orientation == orientation)
|
if (nvis_children > 0 && private->orientation == orientation)
|
||||||
{
|
{
|
||||||
if (box->homogeneous)
|
if (private->homogeneous)
|
||||||
{
|
{
|
||||||
minimum *= nvis_children;
|
minimum *= nvis_children;
|
||||||
natural *= nvis_children;
|
natural *= nvis_children;
|
||||||
}
|
}
|
||||||
minimum += (nvis_children - 1) * box->spacing;
|
minimum += (nvis_children - 1) * private->spacing;
|
||||||
natural += (nvis_children - 1) * box->spacing;
|
natural += (nvis_children - 1) * private->spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
minimum += border_width * 2;
|
minimum += border_width * 2;
|
||||||
@ -963,7 +975,7 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
|||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
GtkBoxPriv *private = box->priv;
|
||||||
GtkBoxChild *child;
|
GtkBoxChild *child;
|
||||||
GList *children;
|
GList *children;
|
||||||
gint nvis_children;
|
gint nvis_children;
|
||||||
@ -982,10 +994,10 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
|||||||
gint extra, i;
|
gint extra, i;
|
||||||
gint child_size, child_minimum, child_natural;
|
gint child_size, child_minimum, child_natural;
|
||||||
|
|
||||||
size = avail_size - border_width * 2 - (nvis_children - 1) * box->spacing;
|
size = avail_size - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||||
|
|
||||||
/* Retrieve desired size for visible children */
|
/* Retrieve desired size for visible children */
|
||||||
for (i = 0, children = box->children; children; children = children->next)
|
for (i = 0, children = private->children; children; children = children->next)
|
||||||
{
|
{
|
||||||
child = children->data;
|
child = children->data;
|
||||||
|
|
||||||
@ -1024,12 +1036,12 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (box->homogeneous)
|
if (private->homogeneous)
|
||||||
{
|
{
|
||||||
/* If were homogenous we still need to run the above loop to get the minimum sizes
|
/* If were homogenous we still need to run the above loop to get the minimum sizes
|
||||||
* for children that are not going to fill
|
* for children that are not going to fill
|
||||||
*/
|
*/
|
||||||
size = avail_size - border_width * 2 - (nvis_children - 1) * box->spacing;
|
size = avail_size - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||||
extra = size / nvis_children;
|
extra = size / nvis_children;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1089,7 +1101,7 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
|||||||
/* Allocate child positions. */
|
/* Allocate child positions. */
|
||||||
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
|
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
|
||||||
{
|
{
|
||||||
for (i = 0, children = box->children; children; children = children->next)
|
for (i = 0, children = private->children; children; children = children->next)
|
||||||
{
|
{
|
||||||
child = children->data;
|
child = children->data;
|
||||||
|
|
||||||
@ -1098,7 +1110,7 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
|||||||
if (child->pack == packing)
|
if (child->pack == packing)
|
||||||
{
|
{
|
||||||
/* Assign the child's size. */
|
/* Assign the child's size. */
|
||||||
if (box->homogeneous)
|
if (private->homogeneous)
|
||||||
{
|
{
|
||||||
if (nvis_children == 1)
|
if (nvis_children == 1)
|
||||||
child_size = size;
|
child_size = size;
|
||||||
@ -1167,7 +1179,7 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
|
|||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
GtkBoxPriv *private = box->priv;
|
||||||
GList *children;
|
GList *children;
|
||||||
gint nvis_children = 0;
|
gint nvis_children = 0;
|
||||||
gint required_size = 0, required_natural = 0, child_size, child_natural;
|
gint required_size = 0, required_natural = 0, child_size, child_natural;
|
||||||
@ -1175,7 +1187,7 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
|
|||||||
|
|
||||||
avail_size -= GTK_CONTAINER (box)->border_width * 2;
|
avail_size -= GTK_CONTAINER (box)->border_width * 2;
|
||||||
|
|
||||||
for (children = box->children; children != NULL;
|
for (children = private->children; children != NULL;
|
||||||
children = children->next, nvis_children++)
|
children = children->next, nvis_children++)
|
||||||
{
|
{
|
||||||
GtkBoxChild *child = children->data;
|
GtkBoxChild *child = children->data;
|
||||||
@ -1207,14 +1219,14 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
|
|||||||
|
|
||||||
if (nvis_children > 0)
|
if (nvis_children > 0)
|
||||||
{
|
{
|
||||||
if (box->homogeneous)
|
if (private->homogeneous)
|
||||||
{
|
{
|
||||||
required_size = largest_child * nvis_children;
|
required_size = largest_child * nvis_children;
|
||||||
required_natural = largest_natural * nvis_children;
|
required_natural = largest_natural * nvis_children;
|
||||||
}
|
}
|
||||||
|
|
||||||
required_size += (nvis_children - 1) * box->spacing;
|
required_size += (nvis_children - 1) * private->spacing;
|
||||||
required_natural += (nvis_children - 1) * box->spacing;
|
required_natural += (nvis_children - 1) * private->spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
required_size += GTK_CONTAINER (box)->border_width * 2;
|
required_size += GTK_CONTAINER (box)->border_width * 2;
|
||||||
@ -1234,7 +1246,7 @@ gtk_box_get_width_for_height (GtkSizeRequest *widget,
|
|||||||
gint *natural_width)
|
gint *natural_width)
|
||||||
{
|
{
|
||||||
GtkBox *box = GTK_BOX (widget);
|
GtkBox *box = GTK_BOX (widget);
|
||||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (widget);
|
GtkBoxPriv *private = box->priv;
|
||||||
|
|
||||||
if (private->orientation == GTK_ORIENTATION_VERTICAL)
|
if (private->orientation == GTK_ORIENTATION_VERTICAL)
|
||||||
gtk_box_compute_size_for_opposing_orientation (box, height, minimum_width, natural_width);
|
gtk_box_compute_size_for_opposing_orientation (box, height, minimum_width, natural_width);
|
||||||
@ -1249,7 +1261,7 @@ gtk_box_get_height_for_width (GtkSizeRequest *widget,
|
|||||||
gint *natural_height)
|
gint *natural_height)
|
||||||
{
|
{
|
||||||
GtkBox *box = GTK_BOX (widget);
|
GtkBox *box = GTK_BOX (widget);
|
||||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (widget);
|
GtkBoxPriv *private = box->priv;
|
||||||
|
|
||||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
gtk_box_compute_size_for_opposing_orientation (box, width, minimum_height, natural_height);
|
gtk_box_compute_size_for_opposing_orientation (box, width, minimum_height, natural_height);
|
||||||
@ -1359,11 +1371,15 @@ void
|
|||||||
gtk_box_set_homogeneous (GtkBox *box,
|
gtk_box_set_homogeneous (GtkBox *box,
|
||||||
gboolean homogeneous)
|
gboolean homogeneous)
|
||||||
{
|
{
|
||||||
|
GtkBoxPriv *private;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_BOX (box));
|
g_return_if_fail (GTK_IS_BOX (box));
|
||||||
|
|
||||||
if ((homogeneous ? TRUE : FALSE) != box->homogeneous)
|
private = box->priv;
|
||||||
|
|
||||||
|
if ((homogeneous ? TRUE : FALSE) != private->homogeneous)
|
||||||
{
|
{
|
||||||
box->homogeneous = homogeneous ? TRUE : FALSE;
|
private->homogeneous = homogeneous ? TRUE : FALSE;
|
||||||
g_object_notify (G_OBJECT (box), "homogeneous");
|
g_object_notify (G_OBJECT (box), "homogeneous");
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (box));
|
gtk_widget_queue_resize (GTK_WIDGET (box));
|
||||||
}
|
}
|
||||||
@ -1383,7 +1399,7 @@ gtk_box_get_homogeneous (GtkBox *box)
|
|||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_BOX (box), FALSE);
|
g_return_val_if_fail (GTK_IS_BOX (box), FALSE);
|
||||||
|
|
||||||
return box->homogeneous;
|
return box->priv->homogeneous;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1398,11 +1414,15 @@ void
|
|||||||
gtk_box_set_spacing (GtkBox *box,
|
gtk_box_set_spacing (GtkBox *box,
|
||||||
gint spacing)
|
gint spacing)
|
||||||
{
|
{
|
||||||
|
GtkBoxPriv *private;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_BOX (box));
|
g_return_if_fail (GTK_IS_BOX (box));
|
||||||
|
|
||||||
if (spacing != box->spacing)
|
private = box->priv;
|
||||||
|
|
||||||
|
if (spacing != private->spacing)
|
||||||
{
|
{
|
||||||
box->spacing = spacing;
|
private->spacing = spacing;
|
||||||
_gtk_box_set_spacing_set (box, TRUE);
|
_gtk_box_set_spacing_set (box, TRUE);
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (box), "spacing");
|
g_object_notify (G_OBJECT (box), "spacing");
|
||||||
@ -1424,18 +1444,18 @@ gtk_box_get_spacing (GtkBox *box)
|
|||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_BOX (box), 0);
|
g_return_val_if_fail (GTK_IS_BOX (box), 0);
|
||||||
|
|
||||||
return box->spacing;
|
return box->priv->spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_box_set_spacing_set (GtkBox *box,
|
_gtk_box_set_spacing_set (GtkBox *box,
|
||||||
gboolean spacing_set)
|
gboolean spacing_set)
|
||||||
{
|
{
|
||||||
GtkBoxPrivate *private;
|
GtkBoxPriv *private;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_BOX (box));
|
g_return_if_fail (GTK_IS_BOX (box));
|
||||||
|
|
||||||
private = GTK_BOX_GET_PRIVATE (box);
|
private = box->priv;
|
||||||
|
|
||||||
private->spacing_set = spacing_set ? TRUE : FALSE;
|
private->spacing_set = spacing_set ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
@ -1443,11 +1463,11 @@ _gtk_box_set_spacing_set (GtkBox *box,
|
|||||||
gboolean
|
gboolean
|
||||||
_gtk_box_get_spacing_set (GtkBox *box)
|
_gtk_box_get_spacing_set (GtkBox *box)
|
||||||
{
|
{
|
||||||
GtkBoxPrivate *private;
|
GtkBoxPriv *private;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_BOX (box), FALSE);
|
g_return_val_if_fail (GTK_IS_BOX (box), FALSE);
|
||||||
|
|
||||||
private = GTK_BOX_GET_PRIVATE (box);
|
private = box->priv;
|
||||||
|
|
||||||
return private->spacing_set;
|
return private->spacing_set;
|
||||||
}
|
}
|
||||||
@ -1476,6 +1496,7 @@ gtk_box_reorder_child (GtkBox *box,
|
|||||||
GtkWidget *child,
|
GtkWidget *child,
|
||||||
gint position)
|
gint position)
|
||||||
{
|
{
|
||||||
|
GtkBoxPriv *priv;
|
||||||
GList *old_link;
|
GList *old_link;
|
||||||
GList *new_link;
|
GList *new_link;
|
||||||
GtkBoxChild *child_info = NULL;
|
GtkBoxChild *child_info = NULL;
|
||||||
@ -1484,7 +1505,9 @@ gtk_box_reorder_child (GtkBox *box,
|
|||||||
g_return_if_fail (GTK_IS_BOX (box));
|
g_return_if_fail (GTK_IS_BOX (box));
|
||||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||||
|
|
||||||
old_link = box->children;
|
priv = box->priv;
|
||||||
|
|
||||||
|
old_link = priv->children;
|
||||||
old_position = 0;
|
old_position = 0;
|
||||||
while (old_link)
|
while (old_link)
|
||||||
{
|
{
|
||||||
@ -1501,14 +1524,14 @@ gtk_box_reorder_child (GtkBox *box,
|
|||||||
if (position == old_position)
|
if (position == old_position)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
box->children = g_list_delete_link (box->children, old_link);
|
priv->children = g_list_delete_link (priv->children, old_link);
|
||||||
|
|
||||||
if (position < 0)
|
if (position < 0)
|
||||||
new_link = NULL;
|
new_link = NULL;
|
||||||
else
|
else
|
||||||
new_link = g_list_nth (box->children, position);
|
new_link = g_list_nth (priv->children, position);
|
||||||
|
|
||||||
box->children = g_list_insert_before (box->children, new_link, child_info);
|
priv->children = g_list_insert_before (priv->children, new_link, child_info);
|
||||||
|
|
||||||
gtk_widget_child_notify (child, "position");
|
gtk_widget_child_notify (child, "position");
|
||||||
if (gtk_widget_get_visible (child)
|
if (gtk_widget_get_visible (child)
|
||||||
@ -1535,13 +1558,16 @@ gtk_box_query_child_packing (GtkBox *box,
|
|||||||
guint *padding,
|
guint *padding,
|
||||||
GtkPackType *pack_type)
|
GtkPackType *pack_type)
|
||||||
{
|
{
|
||||||
|
GtkBoxPriv *private;
|
||||||
GList *list;
|
GList *list;
|
||||||
GtkBoxChild *child_info = NULL;
|
GtkBoxChild *child_info = NULL;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_BOX (box));
|
g_return_if_fail (GTK_IS_BOX (box));
|
||||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||||
|
|
||||||
list = box->children;
|
private = box->priv;
|
||||||
|
|
||||||
|
list = private->children;
|
||||||
while (list)
|
while (list)
|
||||||
{
|
{
|
||||||
child_info = list->data;
|
child_info = list->data;
|
||||||
@ -1583,13 +1609,16 @@ gtk_box_set_child_packing (GtkBox *box,
|
|||||||
guint padding,
|
guint padding,
|
||||||
GtkPackType pack_type)
|
GtkPackType pack_type)
|
||||||
{
|
{
|
||||||
|
GtkBoxPriv *private;
|
||||||
GList *list;
|
GList *list;
|
||||||
GtkBoxChild *child_info = NULL;
|
GtkBoxChild *child_info = NULL;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_BOX (box));
|
g_return_if_fail (GTK_IS_BOX (box));
|
||||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||||
|
|
||||||
list = box->children;
|
private = box->priv;
|
||||||
|
|
||||||
|
list = private->children;
|
||||||
while (list)
|
while (list)
|
||||||
{
|
{
|
||||||
child_info = list->data;
|
child_info = list->data;
|
||||||
@ -1624,11 +1653,11 @@ gtk_box_set_child_packing (GtkBox *box,
|
|||||||
void
|
void
|
||||||
_gtk_box_set_old_defaults (GtkBox *box)
|
_gtk_box_set_old_defaults (GtkBox *box)
|
||||||
{
|
{
|
||||||
GtkBoxPrivate *private;
|
GtkBoxPriv *private;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_BOX (box));
|
g_return_if_fail (GTK_IS_BOX (box));
|
||||||
|
|
||||||
private = GTK_BOX_GET_PRIVATE (box);
|
private = box->priv;
|
||||||
|
|
||||||
private->default_expand = TRUE;
|
private->default_expand = TRUE;
|
||||||
}
|
}
|
||||||
@ -1637,11 +1666,11 @@ static void
|
|||||||
gtk_box_add (GtkContainer *container,
|
gtk_box_add (GtkContainer *container,
|
||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (container);
|
GtkBoxPriv *priv = GTK_BOX (container)->priv;
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (container), widget,
|
gtk_box_pack_start (GTK_BOX (container), widget,
|
||||||
private->default_expand,
|
priv->default_expand,
|
||||||
private->default_expand,
|
priv->default_expand,
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1650,10 +1679,11 @@ gtk_box_remove (GtkContainer *container,
|
|||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GtkBox *box = GTK_BOX (container);
|
GtkBox *box = GTK_BOX (container);
|
||||||
|
GtkBoxPriv *priv = box->priv;
|
||||||
GtkBoxChild *child;
|
GtkBoxChild *child;
|
||||||
GList *children;
|
GList *children;
|
||||||
|
|
||||||
children = box->children;
|
children = priv->children;
|
||||||
while (children)
|
while (children)
|
||||||
{
|
{
|
||||||
child = children->data;
|
child = children->data;
|
||||||
@ -1665,7 +1695,7 @@ gtk_box_remove (GtkContainer *container,
|
|||||||
was_visible = gtk_widget_get_visible (widget);
|
was_visible = gtk_widget_get_visible (widget);
|
||||||
gtk_widget_unparent (widget);
|
gtk_widget_unparent (widget);
|
||||||
|
|
||||||
box->children = g_list_remove_link (box->children, children);
|
priv->children = g_list_remove_link (priv->children, children);
|
||||||
g_list_free (children);
|
g_list_free (children);
|
||||||
g_free (child);
|
g_free (child);
|
||||||
|
|
||||||
@ -1689,10 +1719,11 @@ gtk_box_forall (GtkContainer *container,
|
|||||||
gpointer callback_data)
|
gpointer callback_data)
|
||||||
{
|
{
|
||||||
GtkBox *box = GTK_BOX (container);
|
GtkBox *box = GTK_BOX (container);
|
||||||
|
GtkBoxPriv *priv = box->priv;
|
||||||
GtkBoxChild *child;
|
GtkBoxChild *child;
|
||||||
GList *children;
|
GList *children;
|
||||||
|
|
||||||
children = box->children;
|
children = priv->children;
|
||||||
while (children)
|
while (children)
|
||||||
{
|
{
|
||||||
child = children->data;
|
child = children->data;
|
||||||
@ -1702,7 +1733,7 @@ gtk_box_forall (GtkContainer *container,
|
|||||||
(* callback) (child->widget, callback_data);
|
(* callback) (child->widget, callback_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
children = g_list_last (box->children);
|
children = g_list_last (priv->children);
|
||||||
while (children)
|
while (children)
|
||||||
{
|
{
|
||||||
child = children->data;
|
child = children->data;
|
||||||
|
@ -47,16 +47,15 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
|
|
||||||
typedef struct _GtkBox GtkBox;
|
typedef struct _GtkBox GtkBox;
|
||||||
|
typedef struct _GtkBoxPriv GtkBoxPriv;
|
||||||
typedef struct _GtkBoxClass GtkBoxClass;
|
typedef struct _GtkBoxClass GtkBoxClass;
|
||||||
|
|
||||||
struct _GtkBox
|
struct _GtkBox
|
||||||
{
|
{
|
||||||
GtkContainer container;
|
GtkContainer container;
|
||||||
|
|
||||||
/*< public >*/
|
/*< private >*/
|
||||||
GList *GSEAL (children);
|
GtkBoxPriv *priv;
|
||||||
gint16 GSEAL (spacing);
|
|
||||||
guint GSEAL (homogeneous) : 1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkBoxClass
|
struct _GtkBoxClass
|
||||||
|
Loading…
Reference in New Issue
Block a user