Fixed a multitude of C89 compatibility warnings.
[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 #ifndef __G_SHEET_MODEL_H__
19 #define __G_SHEET_MODEL_H__
20
21
22 /* This file provides an abstract interface or the data displayed by the  
23    GtkSheet widget */
24
25 #include <glib-object.h>
26 #include <gdk/gdk.h>
27 #include <gtk/gtk.h>
28
29
30 G_BEGIN_DECLS
31
32 #define G_TYPE_SHEET_MODEL            (g_sheet_model_get_type ())
33 #define G_SHEET_MODEL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_SHEET_MODEL, GSheetModel))
34 #define G_IS_SHEET_MODEL(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_SHEET_MODEL))
35 #define G_SHEET_MODEL_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_SHEET_MODEL, GSheetModelIface))
36
37 typedef enum
38 {
39   GTK_SHEET_LEFT_BORDER     = 1 << 0, 
40   GTK_SHEET_RIGHT_BORDER    = 1 << 1, 
41   GTK_SHEET_TOP_BORDER      = 1 << 2, 
42   GTK_SHEET_BOTTOM_BORDER   = 1 << 3 
43 } GtkSheetBorderType ; 
44
45
46 typedef struct _GSheetModel        GSheetModel; /* Dummy typedef */
47 typedef struct _GSheetModelIface   GSheetModelIface;
48 typedef struct _GtkSheetRange GtkSheetRange;
49 typedef struct _GtkSheetCellBorder     GtkSheetCellBorder;
50
51 struct _GtkSheetRange
52 {
53   gint row0,col0; /* upper-left cell */
54   gint rowi,coli; /* lower-right cell */
55 };
56
57 struct _GtkSheetCellBorder
58 {
59   GtkSheetBorderType mask;
60   guint width;
61   GdkLineStyle line_style;
62   GdkCapStyle cap_style;
63   GdkJoinStyle join_style;
64   GdkColor color;
65 };
66
67
68
69 struct _GSheetModelIface
70 {
71   GTypeInterface g_iface;
72
73   /* Signals */
74   void         (* range_changed)    (GSheetModel *sheet_model,
75                                      gint row0, gint col0, 
76                                      gint rowi, gint coli);
77
78   void         (* rows_inserted)    (GSheetModel *sheet_model,
79                                      gint row, gint n_rows);
80
81   void         (* rows_deleted)     (GSheetModel *sheet_model,
82                                      gint row, gint n_rows);
83
84
85
86   /* Virtual Table */
87   const gchar *      (* get_string)      (const GSheetModel *sheet_model, 
88                                                gint row, gint column);
89
90   gboolean  (* set_string) (GSheetModel *sheet_model, 
91                             const gchar *s, gint row, gint column);
92
93   gboolean  (* clear_datum) (GSheetModel *sheet_model, 
94                              gint row, gint column);
95
96   gboolean (* is_visible) (const GSheetModel *sheet_model, gint row, gint column);
97   gboolean (* is_editable) (const GSheetModel *sheet_model, gint row, gint column);
98
99   const GdkColor *  (* get_foreground) (const GSheetModel *sheet_model, 
100                                     gint row, gint column);
101
102   const GdkColor *  (* get_background) (const GSheetModel *sheet_model, 
103                                     gint row, gint column);
104
105   const GtkJustification *  (* get_justification) (const GSheetModel *sheet_model, 
106                                                    gint row, gint column);
107
108   const PangoFontDescription *  (* get_font_desc) (const GSheetModel *sheet_model, 
109                                                    gint row, gint column);
110
111   const GtkSheetCellBorder *  (* get_cell_border) (const GSheetModel *sheet_model, 
112                                                    gint row, gint column);
113
114 };
115
116
117
118 GType              g_sheet_model_get_type   (void) G_GNUC_CONST;
119
120
121 inline const gchar * g_sheet_model_get_string (const GSheetModel *sheet_model, 
122                                                gint row, gint column);
123
124 inline gboolean  g_sheet_model_set_string (GSheetModel *sheet_model, 
125                                       const gchar *s, 
126                                       gint row, gint column);
127
128 inline gboolean g_sheet_model_datum_clear    (GSheetModel *sheet_model, 
129                                          gint row, gint column);
130
131
132 inline void g_sheet_model_range_changed (GSheetModel *sheet_model,
133                                     gint row0, gint col0,
134                                     gint rowi, gint coli);
135
136 inline void g_sheet_model_rows_deleted (GSheetModel *sheet_model,
137                                    gint row, gint n_rows);
138
139 inline void g_sheet_model_rows_inserted (GSheetModel *sheet_model,
140                                     gint row, gint n_rows);
141
142 inline gboolean g_sheet_model_is_editable (const GSheetModel *model, 
143                                       gint row, gint column);
144
145 inline gboolean g_sheet_model_is_visible 
146                    (const GSheetModel *model, gint row, gint column);
147
148
149 inline const GdkColor *g_sheet_model_get_foreground 
150                    (const GSheetModel *model, gint row, gint column);
151
152 inline const GdkColor *g_sheet_model_get_background 
153                    (const GSheetModel *model, gint row, gint column);
154
155
156 inline const GtkJustification *g_sheet_model_get_justification 
157                    (const GSheetModel *model, gint row, gint column);
158
159
160 inline const PangoFontDescription *g_sheet_model_get_font_desc
161                    (const GSheetModel *model, gint row, gint column);
162
163 inline const GtkSheetCellBorder * g_sheet_model_get_cell_border 
164                    (const GSheetModel *model, gint row, gint column);
165
166
167
168
169 G_END_DECLS
170
171 #endif /* __G_SHEET_MODEL_H__ */