Commit d2c35ec6 authored by Tristan Van Berkom's avatar Tristan Van Berkom

Mega commit to change ->get_desired_size() for ->get_desired_width/height().

This commit changes gtk_extended_layout_get_desired_size() for
per dimension variants. Furthermore this commit reverts the actions
done in size-groups for now as it needs a different approach.

The natural width/height parameters added to aux_info have been changed
for a per width cache for heights and a per height cache for widths.

gtk-demo is still working, currently sizegroups are not taken
into account as mentioned above - size groups need to be alerted both
when the widths and heights are updated independantly and then that
information needs to repropagate also to other extended layout implementors.
parent 1b2be80f
......@@ -719,7 +719,8 @@ gtk_cell_renderer_toggle_set_radio
#ifndef GTK_DISABLE_DEPRECATED
gtk_cell_view_get_cell_renderers
#endif
gtk_cell_view_get_desired_size_of_row
gtk_cell_view_get_desired_height_of_row
gtk_cell_view_get_desired_width_of_row
gtk_cell_view_get_displayed_row
gtk_cell_view_get_model
gtk_cell_view_get_size_of_row
......@@ -1507,14 +1508,18 @@ gtk_expander_set_use_underline
#if IN_HEADER(__GTK_EXTENDED_CELL_H__)
#if IN_FILE(__GTK_EXTENDED_CELL_C__)
gtk_extended_cell_get_type G_GNUC_CONST
gtk_extended_cell_get_desired_size
gtk_extended_cell_get_desired_height
gtk_extended_cell_get_desired_width
gtk_extended_cell_get_height_for_width
gtk_extended_cell_get_width_for_height
#endif
#endif
#if IN_HEADER(__GTK_EXTENDED_LAYOUT_H__)
#if IN_FILE(__GTK_EXTENDED_LAYOUT_C__)
gtk_extended_layout_get_type G_GNUC_CONST
gtk_extended_layout_get_desired_size
gtk_extended_layout_get_desired_height
gtk_extended_layout_get_desired_width
gtk_extended_layout_get_height_for_width
gtk_extended_layout_get_width_for_height
gtk_extended_layout_is_height_for_width
......
......@@ -66,10 +66,13 @@ static void gtk_alignment_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void gtk_alignment_extended_layout_init (GtkExtendedLayoutIface *iface);
static void gtk_alignment_get_desired_size (GtkExtendedLayout *layout,
GtkRequisition *minimum_size,
GtkRequisition *natural_size);
static void gtk_alignment_extended_layout_init (GtkExtendedLayoutIface *iface);
static void gtk_alignment_get_desired_width (GtkExtendedLayout *layout,
gint *minimum_size,
gint *natural_size);
static void gtk_alignment_get_desired_height (GtkExtendedLayout *layout,
gint *minimum_size,
gint *natural_size);
G_DEFINE_TYPE_WITH_CODE (GtkAlignment, gtk_alignment, GTK_TYPE_BIN,
G_IMPLEMENT_INTERFACE (GTK_TYPE_EXTENDED_LAYOUT,
......@@ -484,42 +487,69 @@ gtk_alignment_size_allocate (GtkWidget *widget,
static void
gtk_alignment_extended_layout_init (GtkExtendedLayoutIface *iface)
{
iface->get_desired_size = gtk_alignment_get_desired_size;
iface->get_desired_width = gtk_alignment_get_desired_width;
iface->get_desired_height = gtk_alignment_get_desired_height;
}
static void
gtk_alignment_get_desired_size (GtkExtendedLayout *layout,
GtkRequisition *minimum_size,
GtkRequisition *natural_size)
GtkOrientation orientation,
gint *minimum_size,
gint *natural_size)
{
GtkWidget *child;
GtkAlignmentPrivate *priv;
gint minimum, natural;
priv = GTK_ALIGNMENT_GET_PRIVATE (layout);
minimum_size->width = GTK_CONTAINER (layout)->border_width * 2;
minimum_size->height = GTK_CONTAINER (layout)->border_width * 2;
*natural_size = *minimum_size;
natural = minimum = GTK_CONTAINER (layout)->border_width * 2;
if ((child = gtk_bin_get_child (GTK_BIN (layout))) && gtk_widget_get_visible (child))
{
GtkRequisition child_min, child_nat;
gint child_min, child_nat;
/* Request extra space for the padding: */
minimum_size->width += (priv->padding_left + priv->padding_right);
minimum_size->height += (priv->padding_top + priv->padding_bottom);
*natural_size = *minimum_size;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
minimum += (priv->padding_left + priv->padding_right);
gtk_extended_layout_get_desired_width (GTK_EXTENDED_LAYOUT (child),
&child_min, &child_nat);
}
else
{
minimum += (priv->padding_top + priv->padding_bottom);
gtk_extended_layout_get_desired_height (GTK_EXTENDED_LAYOUT (child),
&child_min, &child_nat);
}
gtk_extended_layout_get_desired_size (GTK_EXTENDED_LAYOUT (child),
&child_min, &child_nat);
natural = minimum;
minimum_size->width += child_min.width;
minimum_size->height += child_min.height;
natural_size->width += child_nat.width;
natural_size->height += child_nat.height;
minimum += child_min;
natural += child_nat;
}
if (minimum_size)
*minimum_size = minimum;
if (natural_size)
*natural_size = natural;
}
static void
gtk_alignment_get_desired_width (GtkExtendedLayout *layout,
gint *minimum_size,
gint *natural_size)
{
gtk_alignment_get_desired_size (layout, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
gtk_alignment_get_desired_height (GtkExtendedLayout *layout,
gint *minimum_size,
gint *natural_size)
{
gtk_alignment_get_desired_size (layout, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
/**
......
......@@ -168,17 +168,16 @@ get_child_padding_delta (GtkBin *bin,
gint *delta_h,
gint *delta_v)
{
GtkRequisition min_req, child_min;
gint hmin, vmin, child_hmin, child_vmin;
gtk_extended_layout_get_desired_size (GTK_EXTENDED_LAYOUT (bin),
&min_req, NULL);
gtk_extended_layout_get_desired_width (GTK_EXTENDED_LAYOUT (bin), &hmin, NULL);
gtk_extended_layout_get_desired_height (GTK_EXTENDED_LAYOUT (bin), &vmin, NULL);
gtk_extended_layout_get_desired_size (GTK_EXTENDED_LAYOUT (bin->child),
&child_min, NULL);
gtk_extended_layout_get_desired_width (GTK_EXTENDED_LAYOUT (bin->child), &child_hmin, NULL);
gtk_extended_layout_get_desired_height (GTK_EXTENDED_LAYOUT (bin->child), &child_vmin, NULL);
*delta_h = min_req.width - child_min.width;
*delta_v = min_req.height - child_min.height;
*delta_h = hmin - child_hmin;
*delta_v = vmin - child_vmin;
}
static void
......@@ -205,7 +204,8 @@ gtk_bin_get_width_for_height (GtkExtendedLayout *layout,
*natural_width = child_nat + hdelta;
}
else
parent_extended_layout_iface->get_height_for_width (layout, height, minimum_width, natural_width);
GTK_EXTENDED_LAYOUT_GET_IFACE (layout)->get_desired_width (layout, minimum_width, natural_width);
/* parent_extended_layout_iface->get_height_for_width (layout, height, minimum_width, natural_width); */
}
static void
......@@ -232,7 +232,8 @@ gtk_bin_get_height_for_width (GtkExtendedLayout *layout,
*natural_height = child_nat + vdelta;
}
else
parent_extended_layout_iface->get_height_for_width (layout, width, minimum_height, natural_height);
GTK_EXTENDED_LAYOUT_GET_IFACE (layout)->get_desired_height (layout, minimum_height, natural_height);
/* parent_extended_layout_iface->get_height_for_width (layout, width, minimum_height, natural_height); */
}
......
......@@ -109,19 +109,22 @@ static void gtk_box_get_child_property (GtkContainer *container,
static GType gtk_box_child_type (GtkContainer *container);
static void gtk_box_extended_layout_init (GtkExtendedLayoutIface *iface);
static void gtk_box_get_desired_size (GtkExtendedLayout *layout,
GtkRequisition *minimum_size,
GtkRequisition *natural_size);
static gboolean gtk_box_is_height_for_width (GtkExtendedLayout *layout);
static void gtk_box_get_width_for_height (GtkExtendedLayout *layout,
gint height,
gint *minimum_width,
gint *natural_width);
static void gtk_box_get_height_for_width (GtkExtendedLayout *layout,
gint width,
gint *minimum_height,
gint *natural_height);
static void gtk_box_extended_layout_init (GtkExtendedLayoutIface *iface);
static gboolean gtk_box_is_height_for_width (GtkExtendedLayout *layout);
static void gtk_box_get_desired_width (GtkExtendedLayout *layout,
gint *minimum_size,
gint *natural_size);
static void gtk_box_get_desired_height (GtkExtendedLayout *layout,
gint *minimum_size,
gint *natural_size);
static void gtk_box_get_width_for_height (GtkExtendedLayout *layout,
gint height,
gint *minimum_width,
gint *natural_width);
static void gtk_box_get_height_for_width (GtkExtendedLayout *layout,
gint width,
gint *minimum_height,
gint *natural_height);
static GtkExtendedLayoutIface *parent_extended_layout_iface;
......@@ -378,8 +381,22 @@ gtk_box_size_allocate (GtkWidget *widget,
/* Assert the api is working properly */
g_assert (sizes[i].minimum_size >= 0);
g_assert (sizes[i].natural_size >= sizes[i].minimum_size);
if (sizes[i].minimum_size < 0)
g_error ("GtkBox child %s minimum %s: %d < 0 for %s %d",
gtk_widget_get_name (GTK_WIDGET (child->widget)),
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
sizes[i].minimum_size,
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "height" : "width",
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? allocation->height : allocation->width);
if (sizes[i].natural_size < sizes[i].minimum_size)
g_error ("GtkBox child %s natural %s: %d < minimum %d for %s %d",
gtk_widget_get_name (GTK_WIDGET (child->widget)),
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
sizes[i].natural_size,
sizes[i].minimum_size,
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "height" : "width",
(private->orientation == GTK_ORIENTATION_HORIZONTAL) ? allocation->height : allocation->width);
size -= sizes[i].minimum_size;
size -= child->padding * 2;
......@@ -749,7 +766,8 @@ gtk_box_extended_layout_init (GtkExtendedLayoutIface *iface)
parent_extended_layout_iface = g_type_interface_peek_parent (iface);
iface->is_height_for_width = gtk_box_is_height_for_width;
iface->get_desired_size = gtk_box_get_desired_size;
iface->get_desired_width = gtk_box_get_desired_width;
iface->get_desired_height = gtk_box_get_desired_height;
iface->get_height_for_width = gtk_box_get_height_for_width;
iface->get_width_for_height = gtk_box_get_width_for_height;
}
......@@ -763,121 +781,106 @@ gtk_box_is_height_for_width (GtkExtendedLayout *layout)
}
static void
gtk_box_get_desired_size (GtkExtendedLayout *layout,
GtkRequisition *minimum_size,
GtkRequisition *natural_size)
gtk_box_get_desired_size (GtkExtendedLayout *layout,
GtkOrientation orientation,
gint *minimum_size,
gint *natural_size)
{
GtkBox *box;
GtkBoxPrivate *private;
GList *children;
gint nvis_children;
gint border_width;
gint minimum, natural;
box = GTK_BOX (layout);
private = GTK_BOX_GET_PRIVATE (box);
border_width = GTK_CONTAINER (box)->border_width;
minimum_size->width = minimum_size->height = 0;
natural_size->width = natural_size->height = 0;
minimum = natural = 0;
nvis_children = 0;
children = box->children;
while (children)
{
GtkBoxChild *child;
child = children->data;
children = children->next;
for (children = box->children; children; children = children->next)
{
GtkBoxChild *child = children->data;
if (gtk_widget_get_visible (child->widget))
{
GtkRequisition child_minimum_size;
GtkRequisition child_natural_size;
gtk_extended_layout_get_desired_size (GTK_EXTENDED_LAYOUT (child->widget),
&child_minimum_size,
&child_natural_size);
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (box->homogeneous)
{
gint width;
gint child_minimum, child_natural;
width = child_minimum_size.width + child->padding * 2;
minimum_size->width = MAX (minimum_size->width, width);
width = child_natural_size.width + child->padding * 2;
natural_size->width = MAX (natural_size->width, width);
}
else
{
minimum_size->width += child_minimum_size.width + child->padding * 2;
natural_size->width += child_natural_size.width + child->padding * 2;
}
if (orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_extended_layout_get_desired_width (GTK_EXTENDED_LAYOUT (child->widget),
&child_minimum, &child_natural);
else
gtk_extended_layout_get_desired_height (GTK_EXTENDED_LAYOUT (child->widget),
&child_minimum, &child_natural);
minimum_size->height = MAX (minimum_size->height, child_minimum_size.height);
natural_size->height = MAX (natural_size->height, child_natural_size.height);
}
else
{
if (private->orientation == orientation)
{
if (box->homogeneous)
{
gint height;
gint largest;
height = child_minimum_size.height + child->padding * 2;
minimum_size->height = MAX (minimum_size->height, height);
largest = child_minimum + child->padding * 2;
minimum = MAX (minimum, largest);
height = child_natural_size.height + child->padding * 2;
natural_size->height = MAX (natural_size->height, height);
largest = child_natural + child->padding * 2;
natural = MAX (natural, largest);
}
else
{
minimum_size->height += child_minimum_size.height + child->padding * 2;
natural_size->height += child_natural_size.height + child->padding * 2;
minimum += child_minimum + child->padding * 2;
natural += child_natural + child->padding * 2;
}
minimum_size->width = MAX (minimum_size->width, child_minimum_size.width);
natural_size->width = MAX (natural_size->width, child_natural_size.width);
}
}
else
{
/* The biggest mins and naturals in the opposing orientation */
minimum = MAX (minimum, child_minimum);
natural = MAX (natural, child_natural);
}
nvis_children += 1;
}
}
if (nvis_children > 0)
if (nvis_children > 0 && private->orientation == orientation)
{
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (box->homogeneous)
{
minimum_size->width *= nvis_children;
natural_size->width *= nvis_children;
}
if (box->homogeneous)
{
minimum *= nvis_children;
natural *= nvis_children;
}
minimum += (nvis_children - 1) * box->spacing;
natural += (nvis_children - 1) * box->spacing;
}
minimum_size->width += (nvis_children - 1) * box->spacing;
natural_size->width += (nvis_children - 1) * box->spacing;
}
else
{
if (box->homogeneous)
{
minimum_size->height *= nvis_children;
natural_size->height *= nvis_children;
}
minimum += border_width * 2;
natural += border_width * 2;
minimum_size->height += (nvis_children - 1) * box->spacing;
natural_size->height += (nvis_children - 1) * box->spacing;
}
}
if (minimum_size)
*minimum_size = minimum;
minimum_size->width += border_width * 2;
minimum_size->height += border_width * 2;
if (natural_size)
*natural_size = natural;
}
natural_size->width += border_width * 2;
natural_size->height += border_width * 2;
static void
gtk_box_get_desired_width (GtkExtendedLayout *layout,
gint *minimum_size,
gint *natural_size)
{
gtk_box_get_desired_size (layout, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
gtk_box_get_desired_height (GtkExtendedLayout *layout,
gint *minimum_size,
gint *natural_size)
{
gtk_box_get_desired_size (layout, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
/**
* size_fits_for_dimension:
......@@ -1101,10 +1104,10 @@ gtk_box_get_width_for_height (GtkExtendedLayout *layout,
if (private->orientation == GTK_ORIENTATION_VERTICAL)
{
#if 0
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);
#else
/* Have the base class return the values previously computed by get_desired_size() */
parent_extended_layout_iface->get_width_for_height (layout, height, minimum_width, natural_width);
/* Return the defaults instead of calculating in the opposing direction */
gtk_extended_layout_get_desired_width (layout, minimum_width, natural_width);
#endif
}
else
......@@ -1125,8 +1128,8 @@ gtk_box_get_height_for_width (GtkExtendedLayout *layout,
#if 0
gtk_box_compute_size_for_opposing_orientation (box, width, minimum_height, natural_height);
#else
/* Have the base class return the values previously computed by get_desired_size() */
parent_extended_layout_iface->get_height_for_width (layout, width, minimum_height, natural_height);
/* Return the defaults instead of calculating in the opposing direction */
gtk_extended_layout_get_desired_height (layout, minimum_height, natural_height);
#endif
}
else
......
......@@ -159,9 +159,12 @@ static void gtk_button_set_use_action_appearance (GtkButton *button,
gboolean use_appearance);
static void gtk_button_extended_layout_init (GtkExtendedLayoutIface *iface);
static void gtk_button_get_desired_size (GtkExtendedLayout *layout,
GtkRequisition *minimum_size,
GtkRequisition *natural_size);
static void gtk_button_get_desired_width (GtkExtendedLayout *layout,
gint *minimum_size,
gint *natural_size);
static void gtk_button_get_desired_height (GtkExtendedLayout *layout,
gint *minimum_size,
gint *natural_size);
static guint button_signals[LAST_SIGNAL] = { 0 };
......@@ -1769,13 +1772,15 @@ gtk_button_finish_activate (GtkButton *button,
static void
gtk_button_extended_layout_init (GtkExtendedLayoutIface *iface)
{
iface->get_desired_size = gtk_button_get_desired_size;
iface->get_desired_width = gtk_button_get_desired_width;
iface->get_desired_height = gtk_button_get_desired_height;
}
static void
gtk_button_get_desired_size (GtkExtendedLayout *layout,
GtkRequisition *minimum_size,
GtkRequisition *natural_size)
GtkOrientation orientation,
gint *minimum_size,
gint *natural_size)
{
GtkButton *button = GTK_BUTTON (layout);
GtkWidget *child;
......@@ -1783,47 +1788,74 @@ gtk_button_get_desired_size (GtkExtendedLayout *layout,
GtkBorder inner_border;
gint focus_width;
gint focus_pad;
gint minimum, natural;
gtk_button_get_props (button, &default_border, NULL, &inner_border, NULL);
gtk_widget_style_get (GTK_WIDGET (layout),
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
NULL);
minimum_size->width = ((GTK_CONTAINER (layout)->border_width +
GTK_WIDGET (layout)->style->xthickness) * 2 +
inner_border.left + inner_border.right);
minimum_size->height = ((GTK_CONTAINER (layout)->border_width +
GTK_WIDGET (layout)->style->ythickness) * 2 +
inner_border.top + inner_border.bottom);
if (gtk_widget_get_can_default (GTK_WIDGET (layout)))
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
minimum_size->width += default_border.left + default_border.right;
minimum_size->height += default_border.top + default_border.bottom;
minimum = ((GTK_CONTAINER (layout)->border_width +
GTK_WIDGET (layout)->style->xthickness) * 2 +
inner_border.left + inner_border.right);
if (gtk_widget_get_can_default (GTK_WIDGET (layout)))
minimum += default_border.left + default_border.right;
}
else
{
minimum = ((GTK_CONTAINER (layout)->border_width +
GTK_WIDGET (layout)->style->ythickness) * 2 +
inner_border.top + inner_border.bottom);
minimum_size->width += 2 * (focus_width + focus_pad);
minimum_size->height += 2 * (focus_width + focus_pad);
if (gtk_widget_get_can_default (GTK_WIDGET (layout)))
minimum += default_border.top + default_border.bottom;
}
*natural_size = *minimum_size;
minimum += 2 * (focus_width + focus_pad);
natural = minimum;
if ((child = gtk_bin_get_child (GTK_BIN (button))) &&
gtk_widget_get_visible (child))
{
GtkRequisition child_min;
GtkRequisition child_nat;
gint child_min, child_nat;
gtk_extended_layout_get_desired_size (GTK_EXTENDED_LAYOUT (child),
&child_min, &child_nat);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_extended_layout_get_desired_width (GTK_EXTENDED_LAYOUT (child),
&child_min, &child_nat);
else
gtk_extended_layout_get_desired_height (GTK_EXTENDED_LAYOUT (child),
&child_min, &child_nat);
minimum_size->width += child_min.width;
minimum_size->height += child_min.height;
natural_size->width += child_nat.width;
natural_size->height += child_nat.height;
minimum += child_min;
natural += child_nat;
}
if (minimum_size)
*minimum_size = minimum;
if (natural_size)
*natural_size = natural;
}
static void
gtk_button_get_desired_width (GtkExtendedLayout *layout,
gint *minimum_size,
gint *natural_size)
{
gtk_button_get_desired_size (layout, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
gtk_button_get_desired_height (GtkExtendedLayout *layout,
gint *minimum_size,
gint *natural_size)
{
gtk_button_get_desired_size (layout, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
/**
* gtk_button_set_label:
......
......@@ -39,7 +39,27 @@ static void gtk_cell_renderer_set_property (GObject *object,
static void set_cell_bg_color (GtkCellRenderer *cell,
GdkColor *color);
static void gtk_cell_renderer_extended_cell_init (GtkExtendedCellIface *iface);
/* Fallback GtkExtendedCell implementation to use remaining ->get_size() implementations */
static void gtk_cell_renderer_extended_cell_init (GtkExtendedCellIface *iface);
static void gtk_cell_renderer_get_desired_width (GtkExtendedCell *cell,
GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
static void gtk_cell_renderer_get_desired_height (GtkExtendedCell *cell,
GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
static void gtk_cell_renderer_get_height_for_width (GtkExtendedCell *cell,
GtkWidget *widget,
gint width,
gint *minimum_height,
gint *natural_height);
static void gtk_cell_renderer_get_width_for_height (GtkExtendedCell *cell,
GtkWidget *widget,
gint height,
gint *minimum_width,
gint *natural_width);
#define GTK_CELL_RENDERER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_RENDERER, GtkCellRendererPrivate))
......@@ -1036,15 +1056,26 @@ gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,
}
}
static void
gtk_cell_renderer_extended_cell_init (GtkExtendedCellIface *iface)
{
iface->get_desired_width = gtk_cell_renderer_get_desired_width;
iface->get_desired_height = gtk_cell_renderer_get_desired_height;
iface->get_width_for_height = gtk_cell_renderer_get_width_for_height;
iface->get_height_for_width = gtk_cell_renderer_get_height_for_width;
}
static void
gtk_cell_renderer_extended_cell_get_desired_size (GtkExtendedCell *cell,
GtkWidget *widget,
GtkRequisition *minimum_size,
GtkRequisition *natural_size)
gtk_cell_renderer_get_desired_size (GtkExtendedCell *cell,
GtkWidget *widget,
GtkOrientation orientation,
gint *minimum_size,
gint *natural_size)
{
GtkRequisition min_req;
/* Fallback on the old API to get the size. */
if (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size)
gtk_cell_renderer_get_size (GTK_CELL_RENDERER (cell), widget, NULL, NULL, NULL,
&min_req.width, &min_req.height);
......@@ -1054,24 +1085,67 @@ gtk_cell_renderer_extended_cell_get_desired_size (GtkExtendedCell *cell,
min_req.height = 0;
}
if (minimum_size)
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
minimum_size->width = min_req.width;
minimum_size->height = min_req.height;
}
if (minimum_size)
*minimum_size = min_req.width;
if (natural_size)
if (natural_size)
*natural_size = min_req.width;
}
else
{
natural_size->width = min_req.width;
natural_size->height = min_req.height;
if (minimum_size)
*minimum_size = min_req.height;
if (natural_size)
*natural_size = min_req.height;
}
}
static void
gtk_cell_renderer_extended_cell_init (GtkExtendedCellIface *iface)
gtk_cell_renderer_get_desired_width (GtkExtendedCell *cell,
GtkWidget *widget,
gint *minimum_size,
gint *natural_size)
{
gtk_cell_renderer_get_desired_size (cell, widget, GTK_ORIENTATION_HORIZONTAL,
minimum_size, natural_size);
}
static void
gtk_cell_renderer_get_desired_height (GtkExtendedCell *cell,
GtkWidget *widget,
gint *minimum_size,
gint *natural_size)
{
gtk_cell_renderer_get_desired_size (cell, widget, GTK_ORIENTATION_VERTICAL,
minimum_size, natural_size);
}
static void
gtk_cell_renderer_get_height_for_width (GtkExtendedCell *cell,
GtkWidget *widget,
gint width,
gint *minimum_height,
gint *natural_height)
{
/* Fall back on the height reported from ->get_size() */
gtk_extended_cell_get_desired_height (cell, widget, minimum_height, natural_height);
}
static void
gtk_cell_renderer_get_width_for_height (GtkExtendedCell *cell,
GtkWidget *widget,
gint height,
gint *minimum_width,
gint *natural_width)
{
iface->get_desired_size = gtk_cell_renderer_extended_cell_get_desired_size;
/* Fall back on the width reported from ->get_size() */
gtk_extended_cell_get_desired_width (cell, widget, minimum_width, natural_width);
}
#define __GTK_CELL_RENDERER_C__