27bea1c00f8829e4a1e90379f98e2375eab6c339
[pspp-builds.git] / src / ui / gui / psppire-data-store.h
1 /* psppire-data-store.h
2
3    PSPPIRE --- A Graphical User Interface for PSPP
4    Copyright (C) 2006  Free Software Foundation
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19    02110-1301, USA. */
20
21 #ifndef __PSPPIRE_DATA_STORE_H__
22 #define __PSPPIRE_DATA_STORE_H__
23
24 #include <gtksheet/gsheetmodel.h>
25 #include "psppire-dict.h"
26 #include "psppire-case-file.h"
27
28 #define FIRST_CASE_NUMBER 1
29
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
34
35 #define GTK_TYPE_DATA_STORE            (psppire_data_store_get_type ())
36
37 #define PSPPIRE_DATA_STORE(obj)        (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
38                                                                     GTK_TYPE_DATA_STORE, PsppireDataStore))
39
40 #define PSPPIRE_DATA_STORE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), \
41                                                                  GTK_TYPE_DATA_STORE, \
42                                                                  PsppireDataStoreClass))
43
44 #define PSPPIRE_IS_DATA_STORE(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DATA_STORE))
45
46 #define PSPPIRE_IS_DATA_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DATA_STORE))
47
48 #define PSPPIRE_DATA_STORE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
49                                                                    GTK_TYPE_DATA_STORE, \
50                                                                    PsppireDataStoreClass))
51
52 typedef struct _PsppireDataStore       PsppireDataStore;
53 typedef struct _PsppireDataStoreClass  PsppireDataStoreClass;
54
55 struct dictionary;
56
57 struct _PsppireDataStore
58 {
59   GObject parent;
60
61   /*< private >*/
62   PsppireDict *dict;
63   PsppireCaseFile *case_file;
64   const PangoFontDescription *font_desc;
65
66   /* The width of an upper case 'M' rendered in the current font */
67   gint width_of_m ;
68
69   gboolean show_labels;
70
71   /* Geometry */
72   gint margin_width;
73 };
74
75 struct _PsppireDataStoreClass
76 {
77   GObjectClass parent_class;
78
79   /* Padding for future expansion */
80   void (*_gtk_reserved1) (void);
81   void (*_gtk_reserved2) (void);
82   void (*_gtk_reserved3) (void);
83   void (*_gtk_reserved4) (void);
84 };
85
86
87 inline GType psppire_data_store_get_type (void) G_GNUC_CONST;
88 PsppireDataStore *psppire_data_store_new     (PsppireDict *dict);
89
90 void psppire_data_store_set_case_file (PsppireDataStore *data_store,
91                                        PsppireCaseFile *cf);
92
93 void psppire_data_store_set_dictionary (PsppireDataStore *data_store,
94                                         PsppireDict *dict);
95
96 void psppire_data_store_set_font (PsppireDataStore *store,
97                                  const PangoFontDescription *fd);
98
99 void psppire_data_store_show_labels (PsppireDataStore *store,
100                                     gboolean show_labels);
101
102 void psppire_data_store_clear (PsppireDataStore *data_store);
103
104 gboolean psppire_data_store_insert_new_case (PsppireDataStore *ds, gint posn);
105
106 struct casereader * psppire_data_store_get_reader (PsppireDataStore *ds);
107
108 gchar * psppire_data_store_get_string (PsppireDataStore *ds,
109                                        gint row, gint column);
110
111 gboolean psppire_data_store_set_string (PsppireDataStore *ds,
112                                         const gchar *text,
113                                         gint row, gint column);
114
115 #ifdef __cplusplus
116 }
117 #endif /* __cplusplus */
118
119
120 #endif /* __PSPPIRE_DATA_STORE_H__ */