Remove unused sheetmodel function
[pspp-builds.git] / lib / gtksheet / gsheetmodel.c
index 22e3af2efee4d9d3535015c00b23893806c9f360..e200b300fa3f38adb60599f4cc840cc97dc22d43 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <glib.h>
 #include "gsheetmodel.h"
-#include "gtkextra-marshal.h"
+#include <gtksheet/psppire-marshal.h>
 
 enum {
   RANGE_CHANGED,
@@ -37,7 +37,7 @@ static guint sheet_model_signals[LAST_SIGNAL] = { 0 };
 static void      g_sheet_model_base_init   (gpointer           g_class);
 
 
-inline GType
+GType
 g_sheet_model_get_type (void)
 {
   static GType sheet_model_type = 0;
@@ -80,7 +80,7 @@ g_sheet_model_base_init (gpointer g_class)
                      G_SIGNAL_RUN_LAST,
                      G_STRUCT_OFFSET (GSheetModelIface, range_changed),
                      NULL, NULL,
-                     gtkextra_VOID__INT_INT_INT_INT,
+                     psppire_marshal_VOID__INT_INT_INT_INT,
                      G_TYPE_NONE, 4,
                      G_TYPE_INT,
                      G_TYPE_INT,
@@ -95,7 +95,7 @@ g_sheet_model_base_init (gpointer g_class)
                      G_SIGNAL_RUN_LAST,
                      G_STRUCT_OFFSET (GSheetModelIface, rows_inserted),
                      NULL, NULL,
-                     gtkextra_VOID__INT_INT,
+                     psppire_marshal_VOID__INT_INT,
                      G_TYPE_NONE, 2,
                      G_TYPE_INT,
                      G_TYPE_INT);
@@ -107,7 +107,7 @@ g_sheet_model_base_init (gpointer g_class)
                      G_SIGNAL_RUN_LAST,
                      G_STRUCT_OFFSET (GSheetModelIface, rows_deleted),
                      NULL, NULL,
-                     gtkextra_VOID__INT_INT,
+                     psppire_marshal_VOID__INT_INT,
                      G_TYPE_NONE, 2,
                      G_TYPE_INT,
                      G_TYPE_INT);
@@ -118,7 +118,7 @@ g_sheet_model_base_init (gpointer g_class)
                      G_SIGNAL_RUN_LAST,
                      G_STRUCT_OFFSET (GSheetModelIface, columns_inserted),
                      NULL, NULL,
-                     gtkextra_VOID__INT_INT,
+                     psppire_marshal_VOID__INT_INT,
                      G_TYPE_NONE, 2,
                      G_TYPE_INT,
                      G_TYPE_INT);
@@ -130,7 +130,7 @@ g_sheet_model_base_init (gpointer g_class)
                      G_SIGNAL_RUN_LAST,
                      G_STRUCT_OFFSET (GSheetModelIface, columns_deleted),
                      NULL, NULL,
-                     gtkextra_VOID__INT_INT,
+                     psppire_marshal_VOID__INT_INT,
                      G_TYPE_NONE, 2,
                      G_TYPE_INT,
                      G_TYPE_INT);
@@ -148,7 +148,7 @@ g_sheet_model_base_init (gpointer g_class)
  * Returns: True if strings obtained with get_string should be freed by the
  * sheet when no longer required.
  **/
-inline  gboolean
+gboolean
 g_sheet_model_free_strings (const GSheetModel *sheet_model)
 {
   g_return_val_if_fail (G_IS_SHEET_MODEL (sheet_model), FALSE);
@@ -166,9 +166,9 @@ g_sheet_model_free_strings (const GSheetModel *sheet_model)
  * Retrieves the datum at location ROW, COLUMN in the form of a string.
  * Returns: The string representation of the datum, or NULL on error.
  **/
-inline gchar *
+gchar *
 g_sheet_model_get_string (const GSheetModel *sheet_model,
-                         gint row, gint column)
+                         glong row, glong column)
 {
   g_return_val_if_fail (G_IS_SHEET_MODEL (sheet_model), 0);
 
@@ -190,7 +190,7 @@ g_sheet_model_get_string (const GSheetModel *sheet_model,
 gboolean
 g_sheet_model_set_string      (GSheetModel *sheet_model,
                                 const gchar *text,
-                                gint row, gint column)
+                                glong row, glong column)
 {
   g_return_val_if_fail (G_IS_SHEET_MODEL (sheet_model), FALSE);
 
@@ -213,7 +213,7 @@ g_sheet_model_set_string      (GSheetModel *sheet_model,
  **/
 gboolean
 g_sheet_model_datum_clear    (GSheetModel *sheet_model,
-                               gint row, gint column)
+                               glong row, glong column)
 {
   g_return_val_if_fail (G_IS_SHEET_MODEL (sheet_model), FALSE);
 
@@ -233,8 +233,8 @@ g_sheet_model_datum_clear    (GSheetModel *sheet_model,
  **/
 void
 g_sheet_model_range_changed (GSheetModel *sheet_model,
-                              gint row0, gint col0,
-                              gint rowi, gint coli)
+                              glong row0, glong col0,
+                              glong rowi, glong coli)
 {
   g_return_if_fail (G_IS_SHEET_MODEL (sheet_model));
 
@@ -255,7 +255,7 @@ g_sheet_model_range_changed (GSheetModel *sheet_model,
  **/
 void
 g_sheet_model_rows_inserted (GSheetModel *sheet_model,
-                              gint row, gint n_rows)
+                              glong row, glong n_rows)
 {
   g_return_if_fail (G_IS_SHEET_MODEL (sheet_model));
 
@@ -274,7 +274,7 @@ g_sheet_model_rows_inserted (GSheetModel *sheet_model,
  **/
 void
 g_sheet_model_columns_inserted (GSheetModel *sheet_model,
-                              gint column, gint n_columns)
+                              glong column, glong n_columns)
 {
   g_return_if_fail (G_IS_SHEET_MODEL (sheet_model));
 
@@ -295,7 +295,7 @@ g_sheet_model_columns_inserted (GSheetModel *sheet_model,
  **/
 void
 g_sheet_model_rows_deleted (GSheetModel *sheet_model,
-                              gint row, gint n_rows)
+                              glong row, glong n_rows)
 {
   g_return_if_fail (G_IS_SHEET_MODEL (sheet_model));
 
@@ -315,7 +315,7 @@ g_sheet_model_rows_deleted (GSheetModel *sheet_model,
  **/
 void
 g_sheet_model_columns_deleted (GSheetModel *sheet_model,
-                              gint column, gint n_columns)
+                              glong column, glong n_columns)
 {
   g_return_if_fail (G_IS_SHEET_MODEL (sheet_model));
 
@@ -335,9 +335,9 @@ g_sheet_model_columns_deleted (GSheetModel *sheet_model,
  *
  * Returns: TRUE if the cell is editable, FALSE otherwise
  **/
-inline gboolean
+gboolean
 g_sheet_model_is_editable (const GSheetModel *model,
-                            gint row, gint column)
+                            glong row, glong column)
 {
   g_return_val_if_fail (G_IS_SHEET_MODEL (model), TRUE);
 
@@ -348,27 +348,6 @@ g_sheet_model_is_editable (const GSheetModel *model,
                                                          row, column);
 }
 
-/**
- * g_sheet_model_is_visible:
- * @sheet_model: A #GSheetModel
- * @row: The row
- * @column: The column
- *
- * Returns: TRUE if the cell is visible, FALSE otherwise
- **/
-inline gboolean
-g_sheet_model_is_visible (const GSheetModel *model,
-                         gint row, gint column)
-{
-  g_return_val_if_fail (G_IS_SHEET_MODEL (model), TRUE);
-
-  if ( ! G_SHEET_MODEL_GET_IFACE (model)->is_visible )
-    return TRUE;
-
-  return G_SHEET_MODEL_GET_IFACE (model)->is_visible (model,
-                                                       row, column);
-}
-
 
 /**
  * g_sheet_model_get_foreground:
@@ -377,11 +356,11 @@ g_sheet_model_is_visible (const GSheetModel *model,
  * @column: The column
  *
  * Returns the foreground colour of the cell at @row, @column
- * Returns: the foreground colour, or NULL on error.
+ * The color is unallocated.  It will be allocated by the viewing object.
  **/
-inline const GdkColor *
+GdkColor *
 g_sheet_model_get_foreground (const GSheetModel *model,
-                               gint row, gint column)
+                               glong row, glong column)
 {
   g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL);
 
@@ -399,11 +378,11 @@ g_sheet_model_get_foreground (const GSheetModel *model,
  * @column: The column
  *
  * Returns the background colour of the cell at @row, @column
- * Returns: the background colour, or NULL on error.
+ * The color is unallocated.  It will be allocated by the viewing object.
  **/
-inline const GdkColor *
+GdkColor *
 g_sheet_model_get_background (const GSheetModel *model,
-                               gint row, gint column)
+                               glong row, glong column)
 {
   g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL);
 
@@ -423,9 +402,9 @@ g_sheet_model_get_background (const GSheetModel *model,
  * Returns the justification of the cell at @row, @column
  * Returns: the justification, or NULL on error.
  **/
-inline const GtkJustification *
+const GtkJustification *
 g_sheet_model_get_justification (const GSheetModel *model,
-                                  gint row, gint column)
+                                  glong row, glong column)
 {
   g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL);
 
@@ -436,75 +415,128 @@ g_sheet_model_get_justification (const GSheetModel *model,
                                                               row, column);
 }
 
+
 /**
- * g_sheet_model_get_font_desc:
- * @sheet_model: A #GSheetModel
- * @row: The row
- * @column: The column
+ * g_sheet_model_get_column_count:
+ * @model: A #GSheetModel
  *
- * Returns the font description of the cell at @row, @column
- * Returns: the font description, or NULL on error.
+ * Returns the total number of columns represented by the model
  **/
-inline const PangoFontDescription *
-g_sheet_model_get_font_desc(const GSheetModel *model,
-                             gint row, gint column)
+glong
+g_sheet_model_get_column_count (const GSheetModel *model)
 {
-  g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL);
-  if ( ! G_SHEET_MODEL_GET_IFACE (model)->get_font_desc)
-    return NULL;
+  g_return_val_if_fail (G_IS_SHEET_MODEL (model), -1);
 
-  return G_SHEET_MODEL_GET_IFACE (model)->get_font_desc (model,
-                                                          row, column);
+  return G_SHEET_MODEL_GET_IFACE (model)->get_column_count (model);
 }
 
 /**
- * g_sheet_model_get_cell_border:
- * @sheet_model: A #GSheetModel
- * @row: The row
- * @column: The column
+ * g_sheet_model_get_row_count:
+ * @model: A #GSheetModel
  *
- * Returns the cell border of the cell at @row, @column
- * Returns: the cell border, or NULL on error.
+ * Returns the total number of rows represented by the model
  **/
-inline const GtkSheetCellBorder *
-g_sheet_model_get_cell_border (const GSheetModel *model,
-                                gint row, gint column)
+gint
+g_sheet_model_get_row_count(const GSheetModel *model)
+{
+  g_return_val_if_fail (G_IS_SHEET_MODEL (model), -1);
+
+  return G_SHEET_MODEL_GET_IFACE (model)->get_row_count (model);
+}
+
+\f
+
+/* Column related functions  */
+gboolean
+g_sheet_model_get_column_sensitivity (const GSheetModel *model, gint col)
+{
+  g_return_val_if_fail (G_IS_SHEET_MODEL (model), FALSE);
+
+  if ( NULL == G_SHEET_MODEL_GET_IFACE (model)->get_column_sensitivity)
+    return TRUE;
+
+  return G_SHEET_MODEL_GET_IFACE (model)->get_column_sensitivity (model, col);
+}
+
+
+gchar *
+g_sheet_model_get_column_subtitle (const GSheetModel *model,
+                                  gint col)
 {
   g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL);
-  if ( ! G_SHEET_MODEL_GET_IFACE (model)->get_cell_border)
+
+  if ( NULL == G_SHEET_MODEL_GET_IFACE (model)->get_column_subtitle)
     return NULL;
 
-  return G_SHEET_MODEL_GET_IFACE (model)->get_cell_border (model,
-                                                          row, column);
+  return G_SHEET_MODEL_GET_IFACE (model)->get_column_subtitle (model, col);
 }
 
 
+GtkSheetButton *
+g_sheet_model_get_column_button (const GSheetModel *model,
+                                gint col)
+{
+  GtkSheetButton *button = gtk_sheet_button_new ();
 
-/**
- * g_sheet_model_get_column_count:
- * @model: A #GSheetModel
- *
- * Returns the total number of columns represented by the model
- **/
-inline gint
-g_sheet_model_get_column_count(const GSheetModel *model)
+  g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL);
+
+  if ( G_SHEET_MODEL_GET_IFACE (model)->get_column_title)
+    button->label = G_SHEET_MODEL_GET_IFACE (model)->get_column_title (model, col);
+
+  return button;
+}
+
+GtkJustification
+g_sheet_model_get_column_justification (const GSheetModel *model,
+                                       gint col)
 {
-  g_return_val_if_fail (G_IS_SHEET_MODEL (model), -1);
+  g_return_val_if_fail (G_IS_SHEET_MODEL (model), GTK_JUSTIFY_LEFT);
 
-  return G_SHEET_MODEL_GET_IFACE (model)->get_column_count (model);
+  if ( G_SHEET_MODEL_GET_IFACE (model)->get_column_justification)
+    return G_SHEET_MODEL_GET_IFACE (model)->get_column_justification (model, col);
+
+  return GTK_JUSTIFY_LEFT;
 }
 
-/**
- * g_sheet_model_get_row_count:
- * @model: A #GSheetModel
- *
- * Returns the total number of rows represented by the model
- **/
-inline gint
-g_sheet_model_get_row_count(const GSheetModel *model)
+\f
+
+gboolean
+g_sheet_model_get_row_sensitivity (const GSheetModel *model, gint row)
 {
-  g_return_val_if_fail (G_IS_SHEET_MODEL (model), -1);
+  g_return_val_if_fail (G_IS_SHEET_MODEL (model), FALSE);
 
+  if ( NULL == G_SHEET_MODEL_GET_IFACE (model)->get_row_sensitivity)
+    return TRUE;
 
-  return G_SHEET_MODEL_GET_IFACE (model)->get_row_count (model);
+  return G_SHEET_MODEL_GET_IFACE (model)->get_row_sensitivity (model, row);
 }
+
+
+
+gchar *
+g_sheet_model_get_row_subtitle (const GSheetModel *model,
+                               gint row)
+{
+  g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL);
+
+  if ( NULL == G_SHEET_MODEL_GET_IFACE (model)->get_row_subtitle)
+    return NULL;
+
+  return G_SHEET_MODEL_GET_IFACE (model)->get_row_subtitle (model, row);
+}
+
+
+GtkSheetButton *
+g_sheet_model_get_row_button (const GSheetModel *model,
+                                gint row)
+{
+  GtkSheetButton *button = gtk_sheet_button_new ();
+
+  g_return_val_if_fail (G_IS_SHEET_MODEL (model), NULL);
+
+  if ( G_SHEET_MODEL_GET_IFACE (model)->get_row_title)
+    button->label = G_SHEET_MODEL_GET_IFACE (model)->get_row_title (model, row);
+
+  return button;
+}
+