1 /* PsppireSheetModel --- an abstract model for the PsppireSheet widget.
2 * Copyright (C) 2006, 2008 Free Software Foundation
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 #ifndef __PSPPIRE_SHEET_MODEL_H__
18 #define __PSPPIRE_SHEET_MODEL_H__
21 /* This file provides an abstract interface or the data displayed by the
22 PsppireSheet widget */
24 #include <glib-object.h>
27 #include <gtk-contrib/gtkextra-sheet.h>
31 #define PSPPIRE_TYPE_SHEET_MODEL (psppire_sheet_model_get_type ())
32 #define PSPPIRE_SHEET_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_TYPE_SHEET_MODEL, PsppireSheetModel))
33 #define PSPPIRE_IS_SHEET_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_SHEET_MODEL))
34 #define PSPPIRE_SHEET_MODEL_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), PSPPIRE_TYPE_SHEET_MODEL, PsppireSheetModelIface))
38 PSPPIRE_SHEET_LEFT_BORDER = 1 << 0,
39 PSPPIRE_SHEET_RIGHT_BORDER = 1 << 1,
40 PSPPIRE_SHEET_TOP_BORDER = 1 << 2,
41 PSPPIRE_SHEET_BOTTOM_BORDER = 1 << 3
42 } PsppireSheetBorderType ;
45 typedef struct _PsppireSheetModel PsppireSheetModel; /* Dummy typedef */
46 typedef struct _PsppireSheetModelIface PsppireSheetModelIface;
47 typedef struct _PsppireSheetRange PsppireSheetRange;
48 typedef struct _PsppireSheetCellBorder PsppireSheetCellBorder;
50 struct _PsppireSheetRange
52 gint row0, col0; /* upper-left cell */
53 gint rowi, coli; /* lower-right cell */
56 struct _PsppireSheetCellBorder
58 PsppireSheetBorderType mask;
60 GdkLineStyle line_style;
61 GdkCapStyle cap_style;
62 GdkJoinStyle join_style;
68 struct _PsppireSheetModelIface
70 GTypeInterface g_iface;
72 gboolean free_strings;
75 void (* range_changed) (PsppireSheetModel *sheet_model,
76 glong row0, glong col0,
77 glong rowi, glong coli);
79 void (* rows_inserted) (PsppireSheetModel *sheet_model,
80 glong row, glong n_rows);
82 void (* rows_deleted) (PsppireSheetModel *sheet_model,
83 glong row, glong n_rows);
85 void (* columns_inserted) (PsppireSheetModel *sheet_model,
86 glong column, glong n_columns);
88 void (* columns_deleted) (PsppireSheetModel *sheet_model,
89 glong column, glong n_columns);
95 gchar * (* get_string) (const PsppireSheetModel *sheet_model,
96 glong row, glong column);
98 gboolean (* set_string) (PsppireSheetModel *sheet_model,
99 const gchar *s, glong row, glong column);
101 gboolean (* clear_datum) (PsppireSheetModel *sheet_model,
102 glong row, glong column);
104 gboolean (* is_editable) (const PsppireSheetModel *sheet_model, glong row, glong column);
106 GdkColor * (* get_foreground) (const PsppireSheetModel *sheet_model,
107 glong row, glong column);
109 GdkColor * (* get_background) (const PsppireSheetModel *sheet_model,
110 glong row, glong column);
112 const GtkJustification * (* get_justification) (const PsppireSheetModel *sheet_model,
113 glong row, glong column);
115 /* column related metadata */
117 gchar * (*get_column_title) (const PsppireSheetModel *, gint col);
118 gchar * (*get_column_subtitle) (const PsppireSheetModel *, gint col);
119 gboolean (*get_column_sensitivity) (const PsppireSheetModel *, gint col);
120 GtkJustification (*get_column_justification) (const PsppireSheetModel *mode, gint col);
121 const PsppireSheetButton * (* get_button) (const PsppireSheetModel *model, gint col);
123 glong (*get_column_count) (const PsppireSheetModel *model);
126 /* row related metadata */
127 gchar * (*get_row_title) (const PsppireSheetModel *, gint row);
128 gchar * (*get_row_subtitle) (const PsppireSheetModel *, gint row);
129 glong (*get_row_count) (const PsppireSheetModel *model);
130 gboolean (*get_row_sensitivity) (const PsppireSheetModel *, gint row);
132 gboolean (*get_row_overstrike) (const PsppireSheetModel *, gint row);
137 GType psppire_sheet_model_get_type (void) G_GNUC_CONST;
140 gchar * psppire_sheet_model_get_string (const PsppireSheetModel *sheet_model,
141 glong row, glong column);
143 gboolean psppire_sheet_model_set_string (PsppireSheetModel *sheet_model,
145 glong row, glong column);
147 gboolean psppire_sheet_model_datum_clear (PsppireSheetModel *sheet_model,
148 glong row, glong column);
151 void psppire_sheet_model_range_changed (PsppireSheetModel *sheet_model,
152 glong row0, glong col0,
153 glong rowi, glong coli);
155 void psppire_sheet_model_rows_deleted (PsppireSheetModel *sheet_model,
156 glong row, glong n_rows);
158 void psppire_sheet_model_rows_inserted (PsppireSheetModel *sheet_model,
159 glong row, glong n_rows);
161 void psppire_sheet_model_columns_inserted (PsppireSheetModel *sheet_model,
162 glong column, glong n_columns);
164 void psppire_sheet_model_columns_deleted (PsppireSheetModel *sheet_model,
165 glong column, glong n_columns);
168 gboolean psppire_sheet_model_is_editable (const PsppireSheetModel *model,
169 glong row, glong column);
171 gboolean psppire_sheet_model_is_visible
172 (const PsppireSheetModel *model, glong row, glong column);
175 GdkColor *psppire_sheet_model_get_foreground
176 (const PsppireSheetModel *model, glong row, glong column);
178 GdkColor *psppire_sheet_model_get_background
179 (const PsppireSheetModel *model, glong row, glong column);
181 const GtkJustification *psppire_sheet_model_get_justification
182 (const PsppireSheetModel *model, glong row, glong column);
184 const PsppireSheetCellBorder * psppire_sheet_model_get_cell_border
185 (const PsppireSheetModel *model, glong row, glong column);
187 gboolean psppire_sheet_model_free_strings (const PsppireSheetModel *sheet_model);
189 glong psppire_sheet_model_get_column_count (const PsppireSheetModel *sheet_model);
191 gint psppire_sheet_model_get_row_count (const PsppireSheetModel *sheet_model);
195 gboolean psppire_sheet_model_get_column_sensitivity (const PsppireSheetModel *model,
198 gchar * psppire_sheet_model_get_column_subtitle (const PsppireSheetModel *model,
201 PsppireSheetButton * psppire_sheet_model_get_column_button (const PsppireSheetModel *, gint);
203 GtkJustification psppire_sheet_model_get_column_justification (const PsppireSheetModel *,
208 gboolean psppire_sheet_model_get_row_sensitivity (const PsppireSheetModel *model,
212 gchar * psppire_sheet_model_get_row_subtitle (const PsppireSheetModel *model,
216 PsppireSheetButton * psppire_sheet_model_get_row_button (const PsppireSheetModel *, gint);
223 #endif /* __PSPPIRE_SHEET_MODEL_H__ */