Fixed bug reporting the significance of paired value t-test.
[pspp-builds.git] / lib / gtksheet / gsheetmodel.h
1 /* GSheetModel --- an abstract model for the GtkSheet widget.
2  * Copyright (C) 2006 Free Software Foundation
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #ifndef __G_SHEET_MODEL_H__
20 #define __G_SHEET_MODEL_H__
21
22
23 /* This file provides an abstract interface or the data displayed by the
24    GtkSheet widget */
25
26 #include <glib-object.h>
27 #include <gdk/gdk.h>
28 #include <gtk/gtk.h>
29
30
31 G_BEGIN_DECLS
32
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))
37
38 typedef enum
39 {
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 ;
45
46
47 typedef struct _GSheetModel        GSheetModel; /* Dummy typedef */
48 typedef struct _GSheetModelIface   GSheetModelIface;
49 typedef struct _GtkSheetRange GtkSheetRange;
50 typedef struct _GtkSheetCellBorder     GtkSheetCellBorder;
51
52 struct _GtkSheetRange
53 {
54   glong row0,col0; /* upper-left cell */
55   glong rowi,coli; /* lower-right cell */
56 };
57
58 struct _GtkSheetCellBorder
59 {
60   GtkSheetBorderType mask;
61   guint width;
62   GdkLineStyle line_style;
63   GdkCapStyle cap_style;
64   GdkJoinStyle join_style;
65   GdkColor color;
66 };
67
68
69
70 struct _GSheetModelIface
71 {
72   GTypeInterface g_iface;
73
74   gboolean free_strings;
75
76   /* Signals */
77   void         (* range_changed)    (GSheetModel *sheet_model,
78                                      glong row0, glong col0,
79                                      glong rowi, glong coli);
80
81   void         (* rows_inserted)    (GSheetModel *sheet_model,
82                                      glong row, glong n_rows);
83
84   void         (* rows_deleted)     (GSheetModel *sheet_model,
85                                      glong row, glong n_rows);
86
87   void         (* columns_inserted)    (GSheetModel *sheet_model,
88                                      glong column, glong n_columns);
89
90   void         (* columns_deleted)     (GSheetModel *sheet_model,
91                                      glong column, glong n_columns);
92
93
94
95
96   /* Virtual Table */
97
98   gchar *      (* get_string)      (const GSheetModel *sheet_model,
99                                                glong row, glong column);
100
101   gboolean  (* set_string) (GSheetModel *sheet_model,
102                             const gchar *s, glong row, glong column);
103
104   gboolean  (* clear_datum) (GSheetModel *sheet_model,
105                              glong row, glong column);
106
107   gboolean (* is_visible) (const GSheetModel *sheet_model, glong row, glong column);
108   gboolean (* is_editable) (const GSheetModel *sheet_model, glong row, glong column);
109
110   const GdkColor *  (* get_foreground) (const GSheetModel *sheet_model,
111                                     glong row, glong column);
112
113   const GdkColor *  (* get_background) (const GSheetModel *sheet_model,
114                                     glong row, glong column);
115
116   const GtkJustification *  (* get_justification) (const GSheetModel *sheet_model,
117                                                    glong row, glong column);
118
119   const PangoFontDescription *  (* get_font_desc) (const GSheetModel *sheet_model,
120                                                    glong row, glong column);
121
122   const GtkSheetCellBorder *  (* get_cell_border) (const GSheetModel *sheet_model,
123                                                    glong row, glong column);
124
125
126   glong (*get_column_count) (const GSheetModel *model);
127
128   glong (*get_row_count) (const GSheetModel *model);
129
130 };
131
132
133
134 GType              g_sheet_model_get_type   (void) G_GNUC_CONST;
135
136
137 inline  gchar * g_sheet_model_get_string (const GSheetModel *sheet_model,
138                                                glong row, glong column);
139
140 inline gboolean  g_sheet_model_set_string (GSheetModel *sheet_model,
141                                       const gchar *s,
142                                       glong row, glong column);
143
144 inline gboolean g_sheet_model_datum_clear    (GSheetModel *sheet_model,
145                                          glong row, glong column);
146
147
148 inline void g_sheet_model_range_changed (GSheetModel *sheet_model,
149                                     glong row0, glong col0,
150                                     glong rowi, glong coli);
151
152 inline void g_sheet_model_rows_deleted (GSheetModel *sheet_model,
153                                    glong row, glong n_rows);
154
155 inline void g_sheet_model_rows_inserted (GSheetModel *sheet_model,
156                                     glong row, glong n_rows);
157
158 inline void g_sheet_model_columns_inserted (GSheetModel *sheet_model,
159                                             glong column, glong n_columns);
160
161 inline void g_sheet_model_columns_deleted (GSheetModel *sheet_model,
162                                            glong column, glong n_columns);
163
164
165 inline gboolean g_sheet_model_is_editable (const GSheetModel *model,
166                                       glong row, glong column);
167
168 inline gboolean g_sheet_model_is_visible
169                    (const GSheetModel *model, glong row, glong column);
170
171
172 inline const GdkColor *g_sheet_model_get_foreground
173                    (const GSheetModel *model, glong row, glong column);
174
175 inline const GdkColor *g_sheet_model_get_background
176                    (const GSheetModel *model, glong row, glong column);
177
178
179 inline const GtkJustification *g_sheet_model_get_justification
180                    (const GSheetModel *model, glong row, glong column);
181
182
183 inline const PangoFontDescription *g_sheet_model_get_font_desc
184                    (const GSheetModel *model, glong row, glong column);
185
186 inline const GtkSheetCellBorder * g_sheet_model_get_cell_border
187                    (const GSheetModel *model, glong row, glong column);
188
189 inline  gboolean g_sheet_model_free_strings (const GSheetModel *sheet_model);
190
191 inline glong g_sheet_model_get_column_count (const GSheetModel *sheet_model);
192
193 inline  gint g_sheet_model_get_row_count (const GSheetModel *sheet_model);
194
195 G_END_DECLS
196
197 #endif /* __G_SHEET_MODEL_H__ */