[gtk+] Add API for sealed members xpad, ypad, xalign, yalign and sensitive



commit dffc1bf19da9d2f071ee692478e8fca2a77ac600
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jul 14 01:45:03 2009 +0200

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

 gtk/gtk.symbols       |    6 ++
 gtk/gtkcellrenderer.c |  173 +++++++++++++++++++++++++++++++++++++++++++++++--
 gtk/gtkcellrenderer.h |   19 ++++++
 3 files changed, 192 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 0c915dc..ba2dd08 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -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
diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c
index c41a7f8..01acc7a 100644
--- a/gtk/gtkcellrenderer.c
+++ b/gtk/gtkcellrenderer.c
@@ -684,7 +684,7 @@ gtk_cell_renderer_start_editing (GtkCellRenderer      *cell,
  * @cell: A #GtkCellRenderer
  * @width: the width of the cell renderer, or -1
  * @height: the height of the cell renderer, or -1
- * 
+ *
  * Sets the renderer size to be explicit, independent of the properties set.
  **/
 void
@@ -718,9 +718,9 @@ 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.
  **/
 void
@@ -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;
 }
 
 /**
diff --git a/gtk/gtkcellrenderer.h b/gtk/gtkcellrenderer.h
index 8b54292..3d4b1ee 100644
--- a/gtk/gtkcellrenderer.h
+++ b/gtk/gtkcellrenderer.h
@@ -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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]