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>
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 gint row0,col0; /* upper-left cell */
55 gint 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,
79 gint rowi, gint coli);
81 void (* rows_inserted) (GSheetModel *sheet_model,
82 gint row, gint n_rows);
84 void (* rows_deleted) (GSheetModel *sheet_model,
85 gint row, gint n_rows);
90 gchar * (* get_string) (const GSheetModel *sheet_model,
91 gint row, gint column);
93 gboolean (* set_string) (GSheetModel *sheet_model,
94 const gchar *s, gint row, gint column);
96 gboolean (* clear_datum) (GSheetModel *sheet_model,
97 gint row, gint column);
99 gboolean (* is_visible) (const GSheetModel *sheet_model, gint row, gint column);
100 gboolean (* is_editable) (const GSheetModel *sheet_model, gint row, gint column);
102 const GdkColor * (* get_foreground) (const GSheetModel *sheet_model,
103 gint row, gint column);
105 const GdkColor * (* get_background) (const GSheetModel *sheet_model,
106 gint row, gint column);
108 const GtkJustification * (* get_justification) (const GSheetModel *sheet_model,
109 gint row, gint column);
111 const PangoFontDescription * (* get_font_desc) (const GSheetModel *sheet_model,
112 gint row, gint column);
114 const GtkSheetCellBorder * (* get_cell_border) (const GSheetModel *sheet_model,
115 gint row, gint column);
121 GType g_sheet_model_get_type (void) G_GNUC_CONST;
124 inline gchar * g_sheet_model_get_string (const GSheetModel *sheet_model,
125 gint row, gint column);
127 inline gboolean g_sheet_model_set_string (GSheetModel *sheet_model,
129 gint row, gint column);
131 inline gboolean g_sheet_model_datum_clear (GSheetModel *sheet_model,
132 gint row, gint column);
135 inline void g_sheet_model_range_changed (GSheetModel *sheet_model,
136 gint row0, gint col0,
137 gint rowi, gint coli);
139 inline void g_sheet_model_rows_deleted (GSheetModel *sheet_model,
140 gint row, gint n_rows);
142 inline void g_sheet_model_rows_inserted (GSheetModel *sheet_model,
143 gint row, gint n_rows);
145 inline gboolean g_sheet_model_is_editable (const GSheetModel *model,
146 gint row, gint column);
148 inline gboolean g_sheet_model_is_visible
149 (const GSheetModel *model, gint row, gint column);
152 inline const GdkColor *g_sheet_model_get_foreground
153 (const GSheetModel *model, gint row, gint column);
155 inline const GdkColor *g_sheet_model_get_background
156 (const GSheetModel *model, gint row, gint column);
159 inline const GtkJustification *g_sheet_model_get_justification
160 (const GSheetModel *model, gint row, gint column);
163 inline const PangoFontDescription *g_sheet_model_get_font_desc
164 (const GSheetModel *model, gint row, gint column);
166 inline const GtkSheetCellBorder * g_sheet_model_get_cell_border
167 (const GSheetModel *model, gint row, gint column);
169 inline gboolean g_sheet_model_free_strings (const GSheetModel *sheet_model);
175 #endif /* __G_SHEET_MODEL_H__ */