1 /* GSheetModel --- an abstract model for the GtkSheet widget.
2 * Copyright (C) 2006 Free Software Foundation
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library 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 GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef __G_SHEET_MODEL_H__
20 #define __G_SHEET_MODEL_H__
23 /* This file provides an abstract interface or the data displayed by the
26 #include <glib-object.h>
29 #include "gtkextra-sheet.h"
33 #define G_TYPE_SHEET_MODEL (g_sheet_model_get_type ())
34 #define G_SHEET_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_SHEET_MODEL, GSheetModel))
35 #define G_IS_SHEET_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_SHEET_MODEL))
36 #define G_SHEET_MODEL_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_SHEET_MODEL, GSheetModelIface))
40 GTK_SHEET_LEFT_BORDER = 1 << 0,
41 GTK_SHEET_RIGHT_BORDER = 1 << 1,
42 GTK_SHEET_TOP_BORDER = 1 << 2,
43 GTK_SHEET_BOTTOM_BORDER = 1 << 3
44 } GtkSheetBorderType ;
47 typedef struct _GSheetModel GSheetModel; /* Dummy typedef */
48 typedef struct _GSheetModelIface GSheetModelIface;
49 typedef struct _GtkSheetRange GtkSheetRange;
50 typedef struct _GtkSheetCellBorder GtkSheetCellBorder;
54 glong row0, col0; /* upper-left cell */
55 glong rowi, coli; /* lower-right cell */
58 struct _GtkSheetCellBorder
60 GtkSheetBorderType mask;
62 GdkLineStyle line_style;
63 GdkCapStyle cap_style;
64 GdkJoinStyle join_style;
70 struct _GSheetModelIface
72 GTypeInterface g_iface;
74 gboolean free_strings;
77 void (* range_changed) (GSheetModel *sheet_model,
78 glong row0, glong col0,
79 glong rowi, glong coli);
81 void (* rows_inserted) (GSheetModel *sheet_model,
82 glong row, glong n_rows);
84 void (* rows_deleted) (GSheetModel *sheet_model,
85 glong row, glong n_rows);
87 void (* columns_inserted) (GSheetModel *sheet_model,
88 glong column, glong n_columns);
90 void (* columns_deleted) (GSheetModel *sheet_model,
91 glong column, glong n_columns);
100 gchar * (* get_string) (const GSheetModel *sheet_model,
101 glong row, glong column);
103 gboolean (* set_string) (GSheetModel *sheet_model,
104 const gchar *s, glong row, glong column);
106 gboolean (* clear_datum) (GSheetModel *sheet_model,
107 glong row, glong column);
109 gboolean (* is_visible) (const GSheetModel *sheet_model, glong row, glong column);
110 gboolean (* is_editable) (const GSheetModel *sheet_model, glong row, glong column);
112 GdkColor * (* get_foreground) (const GSheetModel *sheet_model,
113 glong row, glong column);
115 GdkColor * (* get_background) (const GSheetModel *sheet_model,
116 glong row, glong column);
118 const GtkJustification * (* get_justification) (const GSheetModel *sheet_model,
119 glong row, glong column);
121 const PangoFontDescription * (* get_font_desc) (const GSheetModel *sheet_model,
122 glong row, glong column);
124 const GtkSheetCellBorder * (* get_cell_border) (const GSheetModel *sheet_model,
125 glong row, glong column);
129 /* column related metadata */
131 gchar * (*get_column_title) (const GSheetModel *, gint col);
132 gchar * (*get_column_subtitle) (const GSheetModel *, gint col);
133 gboolean (*get_column_sensitivity) (const GSheetModel *, gint col);
134 GtkJustification (*get_column_justification) (const GSheetModel *mode, gint col);
135 const GtkSheetButton * (* get_button) (const GSheetModel *model, gint col);
137 glong (*get_column_count) (const GSheetModel *model);
140 /* row related metadata */
141 gchar * (*get_row_title) (const GSheetModel *, gint row);
142 gchar * (*get_row_subtitle) (const GSheetModel *, gint row);
143 glong (*get_row_count) (const GSheetModel *model);
144 gboolean (*get_row_sensitivity) (const GSheetModel *, gint row);
149 GType g_sheet_model_get_type (void) G_GNUC_CONST;
152 gchar * g_sheet_model_get_string (const GSheetModel *sheet_model,
153 glong row, glong column);
155 gboolean g_sheet_model_set_string (GSheetModel *sheet_model,
157 glong row, glong column);
159 gboolean g_sheet_model_datum_clear (GSheetModel *sheet_model,
160 glong row, glong column);
163 void g_sheet_model_range_changed (GSheetModel *sheet_model,
164 glong row0, glong col0,
165 glong rowi, glong coli);
167 void g_sheet_model_rows_deleted (GSheetModel *sheet_model,
168 glong row, glong n_rows);
170 void g_sheet_model_rows_inserted (GSheetModel *sheet_model,
171 glong row, glong n_rows);
173 void g_sheet_model_columns_inserted (GSheetModel *sheet_model,
174 glong column, glong n_columns);
176 void g_sheet_model_columns_deleted (GSheetModel *sheet_model,
177 glong column, glong n_columns);
180 gboolean g_sheet_model_is_editable (const GSheetModel *model,
181 glong row, glong column);
183 gboolean g_sheet_model_is_visible
184 (const GSheetModel *model, glong row, glong column);
187 GdkColor *g_sheet_model_get_foreground
188 (const GSheetModel *model, glong row, glong column);
190 GdkColor *g_sheet_model_get_background
191 (const GSheetModel *model, glong row, glong column);
194 const GtkJustification *g_sheet_model_get_justification
195 (const GSheetModel *model, glong row, glong column);
198 const PangoFontDescription *g_sheet_model_get_font_desc
199 (const GSheetModel *model, glong row, glong column);
201 const GtkSheetCellBorder * g_sheet_model_get_cell_border
202 (const GSheetModel *model, glong row, glong column);
204 gboolean g_sheet_model_free_strings (const GSheetModel *sheet_model);
206 glong g_sheet_model_get_column_count (const GSheetModel *sheet_model);
208 gint g_sheet_model_get_row_count (const GSheetModel *sheet_model);
212 gboolean g_sheet_model_get_column_sensitivity (const GSheetModel *model,
215 gchar * g_sheet_model_get_column_subtitle (const GSheetModel *model,
218 GtkSheetButton * g_sheet_model_get_column_button (const GSheetModel *, gint);
220 GtkJustification g_sheet_model_get_column_justification (const GSheetModel *,
225 gboolean g_sheet_model_get_row_sensitivity (const GSheetModel *model,
229 gchar * g_sheet_model_get_row_subtitle (const GSheetModel *model,
233 GtkSheetButton * g_sheet_model_get_row_button (const GSheetModel *, gint);
240 #endif /* __G_SHEET_MODEL_H__ */