Commit 7e821aa9 authored by Tristan Van Berkom's avatar Tristan Van Berkom

Distribute portions of GtkCellArea:render() background_area argument to cells

Also added gtk_cell_area_get/set_style_detail() to set the string to be
used by the area in gtk_paint_* functions.
parent 33db66e7
......@@ -161,9 +161,6 @@ struct _GtkCellAreaPrivate
*/
GHashTable *cell_info;
/* Tracking which cells are focus siblings of focusable cells */
GHashTable *focus_siblings;
/* The cell border decides how much space to reserve
* around each cell for the background_area
*/
......@@ -183,6 +180,12 @@ struct _GtkCellAreaPrivate
/* Currently focused cell */
GtkCellRenderer *focus_cell;
/* Tracking which cells are focus siblings of focusable cells */
GHashTable *focus_siblings;
/* Detail string to pass to gtk_paint_*() functions */
gchar *style_detail;
};
enum {
......@@ -1065,6 +1068,35 @@ gtk_cell_area_render (GtkCellArea *area,
g_type_name (G_TYPE_FROM_INSTANCE (area)));
}
void
gtk_cell_area_set_style_detail (GtkCellArea *area,
const gchar *detail)
{
GtkCellAreaPrivate *priv;
g_return_if_fail (GTK_IS_CELL_AREA (area));
priv = area->priv;
if (g_strcmp0 (priv->style_detail, detail) != 0)
{
g_free (priv->style_detail);
priv->style_detail = g_strdup (detail);
}
}
G_CONST_RETURN gchar *
gtk_cell_area_get_style_detail (GtkCellArea *area)
{
GtkCellAreaPrivate *priv;
g_return_val_if_fail (GTK_IS_CELL_AREA (area), NULL);
priv = area->priv;
return priv->style_detail;
}
/*************************************************************
* API: Geometry *
*************************************************************/
......
This diff is collapsed.
......@@ -1041,8 +1041,38 @@ gtk_cell_area_box_render (GtkCellArea *area,
*/
gtk_cell_area_inner_cell_area (area, &cell_background, &inner_area);
/* XXX TODO Here after getting the inner area of the cell background,
/* Here after getting the inner area of the cell background,
* add portions of the background area to the cell background */
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (l == allocated_cells)
{
cell_background.width += cell_background.x - background_area->x;
cell_background.x = background_area->x;
}
if (l->next == NULL)
cell_background.width =
background_area->width - (cell_background.x - background_area->x);
cell_background.y = background_area->y;
cell_background.height = background_area->height;
}
else
{
if (l == allocated_cells)
{
cell_background.height += cell_background.y - background_area->y;
cell_background.y = background_area->y;
}
if (l->next == NULL)
cell_background.height =
background_area->height - (cell_background.y - background_area->y);
cell_background.x = background_area->x;
cell_background.width = background_area->width;
}
if (focus_cell &&
(cell->renderer == focus_cell ||
......@@ -1108,15 +1138,11 @@ gtk_cell_area_box_render (GtkCellArea *area,
(flags & GTK_CELL_RENDERER_PRELIT ? GTK_STATE_PRELIGHT :
(flags & GTK_CELL_RENDERER_INSENSITIVE ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL));
gtk_paint_focus (gtk_widget_get_style (widget),
cr, renderer_state,
widget,
/* XXX This hint should be a property on GtkCellArea I suppose */
"treeview",
focus_rect.x,
focus_rect.y,
focus_rect.width,
focus_rect.height);
gtk_paint_focus (gtk_widget_get_style (widget), cr,
renderer_state, widget,
gtk_cell_area_get_style_detail (area),
focus_rect.x, focus_rect.y,
focus_rect.width, focus_rect.height);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment