Add API for sealed members xpad, ypad, xalign, yalign and sensitive

This commit is contained in:
Michael Natterer 2009-07-14 01:45:03 +02:00
parent 9e5b3a46b1
commit dffc1bf19d
3 changed files with 192 additions and 6 deletions

View File

@ -624,11 +624,17 @@ gtk_cell_renderer_activate
#ifndef GTK_DISABLE_DEPRECATED
gtk_cell_renderer_editing_canceled
#endif
gtk_cell_renderer_get_alignment
gtk_cell_renderer_get_fixed_size
gtk_cell_renderer_get_padding
gtk_cell_renderer_get_sensitive
gtk_cell_renderer_get_size
gtk_cell_renderer_get_type G_GNUC_CONST
gtk_cell_renderer_render
gtk_cell_renderer_set_alignment
gtk_cell_renderer_set_fixed_size
gtk_cell_renderer_set_padding
gtk_cell_renderer_set_sensitive
gtk_cell_renderer_start_editing
gtk_cell_renderer_stop_editing
#endif

View File

@ -718,8 +718,8 @@ gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
/**
* gtk_cell_renderer_get_fixed_size:
* @cell: A #GtkCellRenderer
* @width: location to fill in with the fixed width of the widget, or %NULL
* @height: location to fill in with the fixed height of the widget, or %NULL
* @width: location to fill in with the fixed width of the cell, or %NULL
* @height: location to fill in with the fixed height of the cell, or %NULL
*
* Fills in @width and @height with the appropriate size of @cell.
**/
@ -731,9 +731,170 @@ gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
if (width)
(* width) = cell->width;
*width = cell->width;
if (height)
(* height) = cell->height;
*height = cell->height;
}
/**
* gtk_cell_renderer_set_alignment:
* @cell: A #GtkCellRenderer
* @xalign: the x alignment of the cell renderer
* @yalign: the y alignment of the cell renderer
*
* Sets the renderer's alignment within its available space.
*
* Since: 2.18
**/
void
gtk_cell_renderer_set_alignment (GtkCellRenderer *cell,
gfloat xalign,
gfloat yalign)
{
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
g_return_if_fail (xalign >= 0.0 && xalign <= 1.0);
g_return_if_fail (yalign >= 0.0 && yalign <= 1.0);
if ((xalign != cell->xalign) || (yalign != cell->yalign))
{
g_object_freeze_notify (G_OBJECT (cell));
if (xalign != cell->xalign)
{
cell->xalign = xalign;
g_object_notify (G_OBJECT (cell), "xalign");
}
if (yalign != cell->yalign)
{
cell->yalign = yalign;
g_object_notify (G_OBJECT (cell), "yalign");
}
g_object_thaw_notify (G_OBJECT (cell));
}
}
/**
* gtk_cell_renderer_get_alignment:
* @cell: A #GtkCellRenderer
* @xalign: location to fill in with the x alignment of the cell, or %NULL
* @yalign: location to fill in with the y alignment of the cell, or %NULL
*
* Fills in @xalign and @yalign with the appropriate values of @cell.
*
* Since: 2.18
**/
void
gtk_cell_renderer_get_alignment (GtkCellRenderer *cell,
gfloat *xalign,
gfloat *yalign)
{
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
if (xalign)
*xalign = cell->xalign;
if (yalign)
*yalign = cell->yalign;
}
/**
* gtk_cell_renderer_set_padding:
* @cell: A #GtkCellRenderer
* @xpad: the x padding of the cell renderer
* @ypad: the y padding of the cell renderer
*
* Sets the renderer's padding.
*
* Since: 2.18
**/
void
gtk_cell_renderer_set_padding (GtkCellRenderer *cell,
gint xpad,
gint ypad)
{
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
g_return_if_fail (xpad >= 0 && xpad >= 0);
if ((xpad != cell->xpad) || (ypad != cell->ypad))
{
g_object_freeze_notify (G_OBJECT (cell));
if (xpad != cell->xpad)
{
cell->xpad = xpad;
g_object_notify (G_OBJECT (cell), "xpad");
}
if (ypad != cell->ypad)
{
cell->ypad = ypad;
g_object_notify (G_OBJECT (cell), "ypad");
}
g_object_thaw_notify (G_OBJECT (cell));
}
}
/**
* gtk_cell_renderer_get_padding:
* @cell: A #GtkCellRenderer
* @xpad: location to fill in with the x padding of the cell, or %NULL
* @ypad: location to fill in with the y padding of the cell, or %NULL
*
* Fills in @xpad and @ypad with the appropriate values of @cell.
*
* Since: 2.18
**/
void
gtk_cell_renderer_get_padding (GtkCellRenderer *cell,
gint *xpad,
gint *ypad)
{
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
if (xpad)
*xpad = cell->xpad;
if (ypad)
*ypad = cell->ypad;
}
/**
* gtk_cell_renderer_set_sensitive:
* @cell: A #GtkCellRenderer
* @sensitive: the sensitivity of the cell
*
* Sets the cell renderer's sensitivity.
*
* Since: 2.18
**/
void
gtk_cell_renderer_set_sensitive (GtkCellRenderer *cell,
gboolean sensitive)
{
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
if (cell->sensitive != sensitive)
{
cell->sensitive = sensitive ? TRUE : FALSE;
g_object_notify (G_OBJECT (cell), "sensitive");
}
}
/**
* gtk_cell_renderer_get_sensitive:
* @cell: A #GtkCellRenderer
*
* Returns the cell renderer's sensitivity.
*
* Since: 2.18
**/
gboolean
gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell)
{
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
return cell->sensitive;
}
/**

View File

@ -152,6 +152,7 @@ GtkCellEditable *gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
const GdkRectangle *background_area,
const GdkRectangle *cell_area,
GtkCellRendererState flags);
void gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
gint width,
gint height);
@ -159,6 +160,24 @@ void gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
gint *width,
gint *height);
void gtk_cell_renderer_set_alignment (GtkCellRenderer *cell,
gfloat xalign,
gfloat yalign);
void gtk_cell_renderer_get_alignment (GtkCellRenderer *cell,
gfloat *xalign,
gfloat *yalign);
void gtk_cell_renderer_set_padding (GtkCellRenderer *cell,
gint xpad,
gint ypad);
void gtk_cell_renderer_get_padding (GtkCellRenderer *cell,
gint *xpad,
gint *ypad);
void gtk_cell_renderer_set_sensitive (GtkCellRenderer *cell,
gboolean sensitive);
gboolean gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell);
/* For use by cell renderer implementations only */
#ifndef GTK_DISABLE_DEPRECATED
void gtk_cell_renderer_editing_canceled (GtkCellRenderer *cell);