mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
gtkcellrenderer: Move public members to private structure
This commit is contained in:
parent
db584abef3
commit
5e815bfee2
@ -37,11 +37,25 @@ static void set_cell_bg_color (GtkCellRenderer *cell,
|
|||||||
GdkColor *color);
|
GdkColor *color);
|
||||||
|
|
||||||
|
|
||||||
#define GTK_CELL_RENDERER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_RENDERER, GtkCellRendererPrivate))
|
struct _GtkCellRendererPriv
|
||||||
|
|
||||||
typedef struct _GtkCellRendererPrivate GtkCellRendererPrivate;
|
|
||||||
struct _GtkCellRendererPrivate
|
|
||||||
{
|
{
|
||||||
|
gfloat xalign;
|
||||||
|
gfloat yalign;
|
||||||
|
|
||||||
|
gint width;
|
||||||
|
gint height;
|
||||||
|
|
||||||
|
guint16 xpad;
|
||||||
|
guint16 ypad;
|
||||||
|
|
||||||
|
guint mode : 2;
|
||||||
|
guint visible : 1;
|
||||||
|
guint is_expander : 1;
|
||||||
|
guint is_expanded : 1;
|
||||||
|
guint cell_background_set : 1;
|
||||||
|
guint sensitive : 1;
|
||||||
|
guint editing : 1;
|
||||||
|
|
||||||
GdkColor cell_background;
|
GdkColor cell_background;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -79,18 +93,25 @@ G_DEFINE_ABSTRACT_TYPE (GtkCellRenderer, gtk_cell_renderer, GTK_TYPE_OBJECT)
|
|||||||
static void
|
static void
|
||||||
gtk_cell_renderer_init (GtkCellRenderer *cell)
|
gtk_cell_renderer_init (GtkCellRenderer *cell)
|
||||||
{
|
{
|
||||||
cell->mode = GTK_CELL_RENDERER_MODE_INERT;
|
GtkCellRendererPriv *priv;
|
||||||
cell->visible = TRUE;
|
|
||||||
cell->width = -1;
|
cell->priv = G_TYPE_INSTANCE_GET_PRIVATE (cell,
|
||||||
cell->height = -1;
|
GTK_TYPE_CELL_RENDERER,
|
||||||
cell->xalign = 0.5;
|
GtkCellRendererPriv);
|
||||||
cell->yalign = 0.5;
|
priv = cell->priv;
|
||||||
cell->xpad = 0;
|
|
||||||
cell->ypad = 0;
|
priv->mode = GTK_CELL_RENDERER_MODE_INERT;
|
||||||
cell->sensitive = TRUE;
|
priv->visible = TRUE;
|
||||||
cell->is_expander = FALSE;
|
priv->width = -1;
|
||||||
cell->is_expanded = FALSE;
|
priv->height = -1;
|
||||||
cell->editing = FALSE;
|
priv->xalign = 0.5;
|
||||||
|
priv->yalign = 0.5;
|
||||||
|
priv->xpad = 0;
|
||||||
|
priv->ypad = 0;
|
||||||
|
priv->sensitive = TRUE;
|
||||||
|
priv->is_expander = FALSE;
|
||||||
|
priv->is_expanded = FALSE;
|
||||||
|
priv->editing = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -303,7 +324,7 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
|
|||||||
P_("Cell background set"),
|
P_("Cell background set"),
|
||||||
P_("Whether this tag affects the cell background color"));
|
P_("Whether this tag affects the cell background color"));
|
||||||
|
|
||||||
g_type_class_add_private (object_class, sizeof (GtkCellRendererPrivate));
|
g_type_class_add_private (class, sizeof (GtkCellRendererPriv));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -313,45 +334,45 @@ gtk_cell_renderer_get_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
|
GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
|
||||||
GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (object);
|
GtkCellRendererPriv *priv = cell->priv;
|
||||||
|
|
||||||
switch (param_id)
|
switch (param_id)
|
||||||
{
|
{
|
||||||
case PROP_MODE:
|
case PROP_MODE:
|
||||||
g_value_set_enum (value, cell->mode);
|
g_value_set_enum (value, priv->mode);
|
||||||
break;
|
break;
|
||||||
case PROP_VISIBLE:
|
case PROP_VISIBLE:
|
||||||
g_value_set_boolean (value, cell->visible);
|
g_value_set_boolean (value, priv->visible);
|
||||||
break;
|
break;
|
||||||
case PROP_SENSITIVE:
|
case PROP_SENSITIVE:
|
||||||
g_value_set_boolean (value, cell->sensitive);
|
g_value_set_boolean (value, priv->sensitive);
|
||||||
break;
|
break;
|
||||||
case PROP_EDITING:
|
case PROP_EDITING:
|
||||||
g_value_set_boolean (value, cell->editing);
|
g_value_set_boolean (value, priv->editing);
|
||||||
break;
|
break;
|
||||||
case PROP_XALIGN:
|
case PROP_XALIGN:
|
||||||
g_value_set_float (value, cell->xalign);
|
g_value_set_float (value, priv->xalign);
|
||||||
break;
|
break;
|
||||||
case PROP_YALIGN:
|
case PROP_YALIGN:
|
||||||
g_value_set_float (value, cell->yalign);
|
g_value_set_float (value, priv->yalign);
|
||||||
break;
|
break;
|
||||||
case PROP_XPAD:
|
case PROP_XPAD:
|
||||||
g_value_set_uint (value, cell->xpad);
|
g_value_set_uint (value, priv->xpad);
|
||||||
break;
|
break;
|
||||||
case PROP_YPAD:
|
case PROP_YPAD:
|
||||||
g_value_set_uint (value, cell->ypad);
|
g_value_set_uint (value, priv->ypad);
|
||||||
break;
|
break;
|
||||||
case PROP_WIDTH:
|
case PROP_WIDTH:
|
||||||
g_value_set_int (value, cell->width);
|
g_value_set_int (value, priv->width);
|
||||||
break;
|
break;
|
||||||
case PROP_HEIGHT:
|
case PROP_HEIGHT:
|
||||||
g_value_set_int (value, cell->height);
|
g_value_set_int (value, priv->height);
|
||||||
break;
|
break;
|
||||||
case PROP_IS_EXPANDER:
|
case PROP_IS_EXPANDER:
|
||||||
g_value_set_boolean (value, cell->is_expander);
|
g_value_set_boolean (value, priv->is_expander);
|
||||||
break;
|
break;
|
||||||
case PROP_IS_EXPANDED:
|
case PROP_IS_EXPANDED:
|
||||||
g_value_set_boolean (value, cell->is_expanded);
|
g_value_set_boolean (value, priv->is_expanded);
|
||||||
break;
|
break;
|
||||||
case PROP_CELL_BACKGROUND_GDK:
|
case PROP_CELL_BACKGROUND_GDK:
|
||||||
{
|
{
|
||||||
@ -365,7 +386,7 @@ gtk_cell_renderer_get_property (GObject *object,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_CELL_BACKGROUND_SET:
|
case PROP_CELL_BACKGROUND_SET:
|
||||||
g_value_set_boolean (value, cell->cell_background_set);
|
g_value_set_boolean (value, priv->cell_background_set);
|
||||||
break;
|
break;
|
||||||
case PROP_CELL_BACKGROUND:
|
case PROP_CELL_BACKGROUND:
|
||||||
default:
|
default:
|
||||||
@ -382,44 +403,45 @@ gtk_cell_renderer_set_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
|
GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
|
||||||
|
GtkCellRendererPriv *priv = cell->priv;
|
||||||
|
|
||||||
switch (param_id)
|
switch (param_id)
|
||||||
{
|
{
|
||||||
case PROP_MODE:
|
case PROP_MODE:
|
||||||
cell->mode = g_value_get_enum (value);
|
priv->mode = g_value_get_enum (value);
|
||||||
break;
|
break;
|
||||||
case PROP_VISIBLE:
|
case PROP_VISIBLE:
|
||||||
cell->visible = g_value_get_boolean (value);
|
priv->visible = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
case PROP_SENSITIVE:
|
case PROP_SENSITIVE:
|
||||||
cell->sensitive = g_value_get_boolean (value);
|
priv->sensitive = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
case PROP_EDITING:
|
case PROP_EDITING:
|
||||||
cell->editing = g_value_get_boolean (value);
|
priv->editing = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
case PROP_XALIGN:
|
case PROP_XALIGN:
|
||||||
cell->xalign = g_value_get_float (value);
|
priv->xalign = g_value_get_float (value);
|
||||||
break;
|
break;
|
||||||
case PROP_YALIGN:
|
case PROP_YALIGN:
|
||||||
cell->yalign = g_value_get_float (value);
|
priv->yalign = g_value_get_float (value);
|
||||||
break;
|
break;
|
||||||
case PROP_XPAD:
|
case PROP_XPAD:
|
||||||
cell->xpad = g_value_get_uint (value);
|
priv->xpad = g_value_get_uint (value);
|
||||||
break;
|
break;
|
||||||
case PROP_YPAD:
|
case PROP_YPAD:
|
||||||
cell->ypad = g_value_get_uint (value);
|
priv->ypad = g_value_get_uint (value);
|
||||||
break;
|
break;
|
||||||
case PROP_WIDTH:
|
case PROP_WIDTH:
|
||||||
cell->width = g_value_get_int (value);
|
priv->width = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
case PROP_HEIGHT:
|
case PROP_HEIGHT:
|
||||||
cell->height = g_value_get_int (value);
|
priv->height = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
case PROP_IS_EXPANDER:
|
case PROP_IS_EXPANDER:
|
||||||
cell->is_expander = g_value_get_boolean (value);
|
priv->is_expander = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
case PROP_IS_EXPANDED:
|
case PROP_IS_EXPANDED:
|
||||||
cell->is_expanded = g_value_get_boolean (value);
|
priv->is_expanded = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
case PROP_CELL_BACKGROUND:
|
case PROP_CELL_BACKGROUND:
|
||||||
{
|
{
|
||||||
@ -439,7 +461,7 @@ gtk_cell_renderer_set_property (GObject *object,
|
|||||||
set_cell_bg_color (cell, g_value_get_boxed (value));
|
set_cell_bg_color (cell, g_value_get_boxed (value));
|
||||||
break;
|
break;
|
||||||
case PROP_CELL_BACKGROUND_SET:
|
case PROP_CELL_BACKGROUND_SET:
|
||||||
cell->cell_background_set = g_value_get_boolean (value);
|
priv->cell_background_set = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||||
@ -451,13 +473,13 @@ static void
|
|||||||
set_cell_bg_color (GtkCellRenderer *cell,
|
set_cell_bg_color (GtkCellRenderer *cell,
|
||||||
GdkColor *color)
|
GdkColor *color)
|
||||||
{
|
{
|
||||||
GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
|
GtkCellRendererPriv *priv = cell->priv;
|
||||||
|
|
||||||
if (color)
|
if (color)
|
||||||
{
|
{
|
||||||
if (!cell->cell_background_set)
|
if (!priv->cell_background_set)
|
||||||
{
|
{
|
||||||
cell->cell_background_set = TRUE;
|
priv->cell_background_set = TRUE;
|
||||||
g_object_notify (G_OBJECT (cell), "cell-background-set");
|
g_object_notify (G_OBJECT (cell), "cell-background-set");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,9 +489,9 @@ set_cell_bg_color (GtkCellRenderer *cell,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (cell->cell_background_set)
|
if (priv->cell_background_set)
|
||||||
{
|
{
|
||||||
cell->cell_background_set = FALSE;
|
priv->cell_background_set = FALSE;
|
||||||
g_object_notify (G_OBJECT (cell), "cell-background-set");
|
g_object_notify (G_OBJECT (cell), "cell-background-set");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -502,21 +524,24 @@ gtk_cell_renderer_get_size (GtkCellRenderer *cell,
|
|||||||
gint *width,
|
gint *width,
|
||||||
gint *height)
|
gint *height)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererPriv *priv;
|
||||||
gint *real_width = width;
|
gint *real_width = width;
|
||||||
gint *real_height = height;
|
gint *real_height = height;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size != NULL);
|
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size != NULL);
|
||||||
|
|
||||||
if (width && cell->width != -1)
|
priv = cell->priv;
|
||||||
|
|
||||||
|
if (width && priv->width != -1)
|
||||||
{
|
{
|
||||||
real_width = NULL;
|
real_width = NULL;
|
||||||
*width = cell->width;
|
*width = priv->width;
|
||||||
}
|
}
|
||||||
if (height && cell->height != -1)
|
if (height && priv->height != -1)
|
||||||
{
|
{
|
||||||
real_height = NULL;
|
real_height = NULL;
|
||||||
*height = cell->height;
|
*height = priv->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
GTK_CELL_RENDERER_GET_CLASS (cell)->get_size (cell,
|
GTK_CELL_RENDERER_GET_CLASS (cell)->get_size (cell,
|
||||||
@ -557,14 +582,14 @@ gtk_cell_renderer_render (GtkCellRenderer *cell,
|
|||||||
GtkCellRendererState flags)
|
GtkCellRendererState flags)
|
||||||
{
|
{
|
||||||
gboolean selected = FALSE;
|
gboolean selected = FALSE;
|
||||||
GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
|
GtkCellRendererPriv *priv = cell->priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->render != NULL);
|
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->render != NULL);
|
||||||
|
|
||||||
selected = (flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED;
|
selected = (flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED;
|
||||||
|
|
||||||
if (cell->cell_background_set && !selected)
|
if (priv->cell_background_set && !selected)
|
||||||
{
|
{
|
||||||
cairo_t *cr = gdk_cairo_create (window);
|
cairo_t *cr = gdk_cairo_create (window);
|
||||||
|
|
||||||
@ -610,9 +635,13 @@ gtk_cell_renderer_activate (GtkCellRenderer *cell,
|
|||||||
const GdkRectangle *cell_area,
|
const GdkRectangle *cell_area,
|
||||||
GtkCellRendererState flags)
|
GtkCellRendererState flags)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererPriv *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
|
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
|
||||||
|
|
||||||
if (cell->mode != GTK_CELL_RENDERER_MODE_ACTIVATABLE)
|
priv = cell->priv;
|
||||||
|
|
||||||
|
if (priv->mode != GTK_CELL_RENDERER_MODE_ACTIVATABLE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (GTK_CELL_RENDERER_GET_CLASS (cell)->activate == NULL)
|
if (GTK_CELL_RENDERER_GET_CLASS (cell)->activate == NULL)
|
||||||
@ -652,11 +681,14 @@ gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
|
|||||||
GtkCellRendererState flags)
|
GtkCellRendererState flags)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
GtkCellRendererPriv *priv;
|
||||||
GtkCellEditable *editable;
|
GtkCellEditable *editable;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), NULL);
|
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), NULL);
|
||||||
|
|
||||||
if (cell->mode != GTK_CELL_RENDERER_MODE_EDITABLE)
|
priv = cell->priv;
|
||||||
|
|
||||||
|
if (priv->mode != GTK_CELL_RENDERER_MODE_EDITABLE)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (GTK_CELL_RENDERER_GET_CLASS (cell)->start_editing == NULL)
|
if (GTK_CELL_RENDERER_GET_CLASS (cell)->start_editing == NULL)
|
||||||
@ -674,7 +706,7 @@ gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
|
|||||||
cell_renderer_signals[EDITING_STARTED], 0,
|
cell_renderer_signals[EDITING_STARTED], 0,
|
||||||
editable, path);
|
editable, path);
|
||||||
|
|
||||||
cell->editing = TRUE;
|
priv->editing = TRUE;
|
||||||
|
|
||||||
return editable;
|
return editable;
|
||||||
}
|
}
|
||||||
@ -692,22 +724,26 @@ gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
|
|||||||
gint width,
|
gint width,
|
||||||
gint height)
|
gint height)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererPriv *priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
g_return_if_fail (width >= -1 && height >= -1);
|
g_return_if_fail (width >= -1 && height >= -1);
|
||||||
|
|
||||||
if ((width != cell->width) || (height != cell->height))
|
priv = cell->priv;
|
||||||
|
|
||||||
|
if ((width != priv->width) || (height != priv->height))
|
||||||
{
|
{
|
||||||
g_object_freeze_notify (G_OBJECT (cell));
|
g_object_freeze_notify (G_OBJECT (cell));
|
||||||
|
|
||||||
if (width != cell->width)
|
if (width != priv->width)
|
||||||
{
|
{
|
||||||
cell->width = width;
|
priv->width = width;
|
||||||
g_object_notify (G_OBJECT (cell), "width");
|
g_object_notify (G_OBJECT (cell), "width");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (height != cell->height)
|
if (height != priv->height)
|
||||||
{
|
{
|
||||||
cell->height = height;
|
priv->height = height;
|
||||||
g_object_notify (G_OBJECT (cell), "height");
|
g_object_notify (G_OBJECT (cell), "height");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,12 +764,16 @@ gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
|
|||||||
gint *width,
|
gint *width,
|
||||||
gint *height)
|
gint *height)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererPriv *priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
|
|
||||||
|
priv = cell->priv;
|
||||||
|
|
||||||
if (width)
|
if (width)
|
||||||
*width = cell->width;
|
*width = priv->width;
|
||||||
if (height)
|
if (height)
|
||||||
*height = cell->height;
|
*height = priv->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -751,23 +791,27 @@ gtk_cell_renderer_set_alignment (GtkCellRenderer *cell,
|
|||||||
gfloat xalign,
|
gfloat xalign,
|
||||||
gfloat yalign)
|
gfloat yalign)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererPriv *priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
g_return_if_fail (xalign >= 0.0 && xalign <= 1.0);
|
g_return_if_fail (xalign >= 0.0 && xalign <= 1.0);
|
||||||
g_return_if_fail (yalign >= 0.0 && yalign <= 1.0);
|
g_return_if_fail (yalign >= 0.0 && yalign <= 1.0);
|
||||||
|
|
||||||
if ((xalign != cell->xalign) || (yalign != cell->yalign))
|
priv = cell->priv;
|
||||||
|
|
||||||
|
if ((xalign != priv->xalign) || (yalign != priv->yalign))
|
||||||
{
|
{
|
||||||
g_object_freeze_notify (G_OBJECT (cell));
|
g_object_freeze_notify (G_OBJECT (cell));
|
||||||
|
|
||||||
if (xalign != cell->xalign)
|
if (xalign != priv->xalign)
|
||||||
{
|
{
|
||||||
cell->xalign = xalign;
|
priv->xalign = xalign;
|
||||||
g_object_notify (G_OBJECT (cell), "xalign");
|
g_object_notify (G_OBJECT (cell), "xalign");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yalign != cell->yalign)
|
if (yalign != priv->yalign)
|
||||||
{
|
{
|
||||||
cell->yalign = yalign;
|
priv->yalign = yalign;
|
||||||
g_object_notify (G_OBJECT (cell), "yalign");
|
g_object_notify (G_OBJECT (cell), "yalign");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -790,12 +834,16 @@ gtk_cell_renderer_get_alignment (GtkCellRenderer *cell,
|
|||||||
gfloat *xalign,
|
gfloat *xalign,
|
||||||
gfloat *yalign)
|
gfloat *yalign)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererPriv *priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
|
|
||||||
|
priv = cell->priv;
|
||||||
|
|
||||||
if (xalign)
|
if (xalign)
|
||||||
*xalign = cell->xalign;
|
*xalign = priv->xalign;
|
||||||
if (yalign)
|
if (yalign)
|
||||||
*yalign = cell->yalign;
|
*yalign = priv->yalign;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -813,22 +861,26 @@ gtk_cell_renderer_set_padding (GtkCellRenderer *cell,
|
|||||||
gint xpad,
|
gint xpad,
|
||||||
gint ypad)
|
gint ypad)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererPriv *priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
g_return_if_fail (xpad >= 0 && xpad >= 0);
|
g_return_if_fail (xpad >= 0 && xpad >= 0);
|
||||||
|
|
||||||
if ((xpad != cell->xpad) || (ypad != cell->ypad))
|
priv = cell->priv;
|
||||||
|
|
||||||
|
if ((xpad != priv->xpad) || (ypad != priv->ypad))
|
||||||
{
|
{
|
||||||
g_object_freeze_notify (G_OBJECT (cell));
|
g_object_freeze_notify (G_OBJECT (cell));
|
||||||
|
|
||||||
if (xpad != cell->xpad)
|
if (xpad != priv->xpad)
|
||||||
{
|
{
|
||||||
cell->xpad = xpad;
|
priv->xpad = xpad;
|
||||||
g_object_notify (G_OBJECT (cell), "xpad");
|
g_object_notify (G_OBJECT (cell), "xpad");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ypad != cell->ypad)
|
if (ypad != priv->ypad)
|
||||||
{
|
{
|
||||||
cell->ypad = ypad;
|
priv->ypad = ypad;
|
||||||
g_object_notify (G_OBJECT (cell), "ypad");
|
g_object_notify (G_OBJECT (cell), "ypad");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -851,12 +903,16 @@ gtk_cell_renderer_get_padding (GtkCellRenderer *cell,
|
|||||||
gint *xpad,
|
gint *xpad,
|
||||||
gint *ypad)
|
gint *ypad)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererPriv *priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
|
|
||||||
|
priv = cell->priv;
|
||||||
|
|
||||||
if (xpad)
|
if (xpad)
|
||||||
*xpad = cell->xpad;
|
*xpad = priv->xpad;
|
||||||
if (ypad)
|
if (ypad)
|
||||||
*ypad = cell->ypad;
|
*ypad = priv->ypad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -872,11 +928,15 @@ void
|
|||||||
gtk_cell_renderer_set_visible (GtkCellRenderer *cell,
|
gtk_cell_renderer_set_visible (GtkCellRenderer *cell,
|
||||||
gboolean visible)
|
gboolean visible)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererPriv *priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
|
|
||||||
if (cell->visible != visible)
|
priv = cell->priv;
|
||||||
|
|
||||||
|
if (priv->visible != visible)
|
||||||
{
|
{
|
||||||
cell->visible = visible ? TRUE : FALSE;
|
priv->visible = visible ? TRUE : FALSE;
|
||||||
g_object_notify (G_OBJECT (cell), "visible");
|
g_object_notify (G_OBJECT (cell), "visible");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -896,7 +956,7 @@ gtk_cell_renderer_get_visible (GtkCellRenderer *cell)
|
|||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
|
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
|
||||||
|
|
||||||
return cell->visible;
|
return cell->priv->visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -912,11 +972,15 @@ void
|
|||||||
gtk_cell_renderer_set_sensitive (GtkCellRenderer *cell,
|
gtk_cell_renderer_set_sensitive (GtkCellRenderer *cell,
|
||||||
gboolean sensitive)
|
gboolean sensitive)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererPriv *priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
|
|
||||||
if (cell->sensitive != sensitive)
|
priv = cell->priv;
|
||||||
|
|
||||||
|
if (priv->sensitive != sensitive)
|
||||||
{
|
{
|
||||||
cell->sensitive = sensitive ? TRUE : FALSE;
|
priv->sensitive = sensitive ? TRUE : FALSE;
|
||||||
g_object_notify (G_OBJECT (cell), "sensitive");
|
g_object_notify (G_OBJECT (cell), "sensitive");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -936,7 +1000,7 @@ gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell)
|
|||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
|
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
|
||||||
|
|
||||||
return cell->sensitive;
|
return cell->priv->sensitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -958,11 +1022,15 @@ void
|
|||||||
gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,
|
gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,
|
||||||
gboolean canceled)
|
gboolean canceled)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererPriv *priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
|
|
||||||
if (cell->editing)
|
priv = cell->priv;
|
||||||
|
|
||||||
|
if (priv->editing)
|
||||||
{
|
{
|
||||||
cell->editing = FALSE;
|
priv->editing = FALSE;
|
||||||
if (canceled)
|
if (canceled)
|
||||||
g_signal_emit (cell, cell_renderer_signals[EDITING_CANCELED], 0);
|
g_signal_emit (cell, cell_renderer_signals[EDITING_CANCELED], 0);
|
||||||
}
|
}
|
||||||
|
@ -52,29 +52,16 @@ typedef enum
|
|||||||
#define GTK_IS_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_RENDERER))
|
#define GTK_IS_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_RENDERER))
|
||||||
#define GTK_CELL_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_RENDERER, GtkCellRendererClass))
|
#define GTK_CELL_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_RENDERER, GtkCellRendererClass))
|
||||||
|
|
||||||
typedef struct _GtkCellRenderer GtkCellRenderer;
|
typedef struct _GtkCellRenderer GtkCellRenderer;
|
||||||
|
typedef struct _GtkCellRendererPriv GtkCellRendererPriv;
|
||||||
typedef struct _GtkCellRendererClass GtkCellRendererClass;
|
typedef struct _GtkCellRendererClass GtkCellRendererClass;
|
||||||
|
|
||||||
struct _GtkCellRenderer
|
struct _GtkCellRenderer
|
||||||
{
|
{
|
||||||
GtkObject parent;
|
GtkObject parent;
|
||||||
|
|
||||||
gfloat GSEAL (xalign);
|
/* <private> */
|
||||||
gfloat GSEAL (yalign);
|
GtkCellRendererPriv *priv;
|
||||||
|
|
||||||
gint GSEAL (width);
|
|
||||||
gint GSEAL (height);
|
|
||||||
|
|
||||||
guint16 GSEAL (xpad);
|
|
||||||
guint16 GSEAL (ypad);
|
|
||||||
|
|
||||||
guint GSEAL (mode) : 2;
|
|
||||||
guint GSEAL (visible) : 1;
|
|
||||||
guint GSEAL (is_expander) : 1;
|
|
||||||
guint GSEAL (is_expanded) : 1;
|
|
||||||
guint GSEAL (cell_background_set) : 1;
|
|
||||||
guint GSEAL (sensitive) : 1;
|
|
||||||
guint GSEAL (editing) : 1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkCellRendererClass
|
struct _GtkCellRendererClass
|
||||||
|
Loading…
Reference in New Issue
Block a user