]> saetta.ns0.it Git - libgdaex/commitdiff
Get/set functions on GdaExGridColumn.
authorAndrea Zagli <azagli@libero.it>
Mon, 27 Dec 2010 16:08:16 +0000 (17:08 +0100)
committerAndrea Zagli <azagli@libero.it>
Mon, 27 Dec 2010 16:08:16 +0000 (17:08 +0100)
src/grid.c
src/grid.h
src/gridcolumn.c
src/gridcolumn.h

index c0282f4524d648803dfcf40e6432a9c14bf5c69d..10cf8b4e93bc8c61229110a18d94c87a36af8e5b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  grid.c
  *
- *  Copyright (C) 2005-2010 Andrea Zagli <azagli@libero.it>
+ *  Copyright (C) 2010 Andrea Zagli <azagli@libero.it>
  *
  *  This file is part of libgdaex_grid.
  *  
index 6c3bb0250148fcbe302a576f5ad4e98a4439f78f..7dac15ecb444e43c2d1ce7f8d1db273033734c12 100644 (file)
 G_BEGIN_DECLS
 
 
-#define TYPE_GDAEX_GRID                 (gdaex_get_type ())
-#define GDAEX_GRID(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GDAEX_GRID, GdaExGrid))
-#define GDAEX_GRID_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GDAEX_GRID, GdaExGridClass))
-#define IS_GDAEX_GRID(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GDAEX_GRID))
-#define IS_GDAEX_GRID_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GDAEX_GRID))
-#define GDAEX_GRID_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GDAEX_GRID, GdaExGridClass))
+#define GDAEX_TYPE_GRID                 (gdaex_get_type ())
+#define GDAEX_GRID(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDAEX_TYPE_GRID, GdaExGrid))
+#define GDAEX_GRID_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GDAEX_TYPE_GRID, GdaExGridClass))
+#define GDAEX_IS_GRID(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDAEX_TYPE_GRID))
+#define GDAEX_IS_GRID_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GDAEX_TYPE_GRID))
+#define GDAEX_GRID_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GDAEX_TYPE_GRID, GdaExGridClass))
 
 
 typedef struct _GdaExGrid GdaExGrid;
index d654fc32ccc3771f0daf6c6bd99489dde1c6f2c5..3d1dcd32d884bb3a3d637c04b4fa348db1323f1d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  gridcolumn.c
  *
- *  Copyright (C) 2005-2010 Andrea Zagli <azagli@libero.it>
+ *  Copyright (C) 2010 Andrea Zagli <azagli@libero.it>
  *
  *  This file is part of libgdaex_grid_column.
  *  
@@ -69,6 +69,13 @@ static void
 gdaex_grid_column_init (GdaExGridColumn *gdaex_grid_column)
 {
        GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (gdaex_grid_column);
+
+       priv->title = NULL;
+       priv->field_name = NULL;
+       priv->visible = FALSE;
+       priv->resizable = FALSE;
+       priv->sortable = FALSE;
+       priv->reorderable = FALSE;
 }
 
 GdaExGridColumn
@@ -96,73 +103,123 @@ GdaExGridColumn
 void
 gdaex_grid_column_set_title (GdaExGridColumn *column, const gchar *title)
 {
+       g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
+
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
 
+       g_free (priv->title);
+       priv->title = g_strdup (title);
 }
 
 const gchar
 *gdaex_grid_column_get_title (GdaExGridColumn *column)
 {
+       g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), NULL);
 
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+
+       return (const gchar *)g_strdup (priv->title);
 }
 
 void
 gdaex_grid_column_set_field_name (GdaExGridColumn *column, const gchar *field_name)
 {
+       g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
+
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
 
+       g_free (priv->field_name);
+       priv->field_name = g_strdup (field_name);
 }
 
 const gchar
 *gdaex_grid_column_get_field_name (GdaExGridColumn *column)
 {
+       g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), NULL);
 
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+
+       return (const gchar *)g_strdup (priv->field_name);
 }
 
 void
 gdaex_grid_column_set_visible (GdaExGridColumn *column, gboolean visible)
 {
+       g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
+
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
 
+       priv->visible = visible;
 }
 
 gboolean
 gdaex_grid_column_get_visible (GdaExGridColumn *column)
 {
+       g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), FALSE);
+
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
 
+       return priv->visible;
 }
 
 void
 gdaex_grid_column_set_resizable (GdaExGridColumn *column, gboolean resizable)
 {
+       g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
 
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+
+       priv->resizable = resizable;
 }
 
 gboolean
 gdaex_grid_column_get_resizable (GdaExGridColumn *column)
 {
+       g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), FALSE);
+
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
 
+       return priv->resizable;
 }
 
 void
 gdaex_grid_column_set_sortable (GdaExGridColumn *column, gboolean sortable)
 {
+       g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
+
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
 
+       priv->sortable = sortable;
 }
 
 gboolean
 gdaex_grid_column_get_sortable (GdaExGridColumn *column)
 {
+       g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), FALSE);
 
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+
+       return priv->sortable;
 }
 
 void
 gdaex_grid_column_set_reorderable (GdaExGridColumn *column, gboolean reorderable)
 {
+       g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
+
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
 
+       priv->reorderable = reorderable;
 }
 
 gboolean
 gdaex_grid_column_get_reorderable (GdaExGridColumn *column)
 {
+       g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), FALSE);
+
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
 
+       return priv->reorderable;
 }
 
 /* PRIVATE */
index feeafd8f5e746ff06d5fcba04f98b981dc5ad91e..9ecbbbeea7419973c2693380cb4ae1b533b5eb20 100644 (file)
 G_BEGIN_DECLS
 
 
-#define TYPE_GDAEX_GRID_COLUMN                 (gdaex_get_type ())
-#define GDAEX_GRID_COLUMN(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GDAEX_GRID_COLUMN, GdaExGridColumn))
-#define GDAEX_GRID_COLUMN_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GDAEX_GRID_COLUMN, GdaExGridColumnClass))
-#define IS_GDAEX_GRID_COLUMN(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GDAEX_GRID_COLUMN))
-#define IS_GDAEX_GRID_COLUMN_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GDAEX_GRID_COLUMN))
-#define GDAEX_GRID_COLUMN_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GDAEX_GRID_COLUMN, GdaExGridColumnClass))
+#define GDAEX_TYPE_GRID_COLUMN                 (gdaex_get_type ())
+#define GDAEX_GRID_COLUMN(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDAEX_TYPE_GRID_COLUMN, GdaExGridColumn))
+#define GDAEX_GRID_COLUMN_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GDAEX_TYPE_GRID_COLUMN, GdaExGridColumnClass))
+#define GDAEX_IS_GRID_COLUMN(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDAEX_TYPE_GRID_COLUMN))
+#define GDAEX_IS_GRID_COLUMN_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GDAEX_TYPE_GRID_COLUMN))
+#define GDAEX_GRID_COLUMN_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GDAEX_TYPE_GRID_COLUMN, GdaExGridColumnClass))
 
 
 typedef struct _GdaExGridColumn GdaExGridColumn;