bbb44ee20b08a9130d59f84fb8dd90d84cba17ba
[pspp-builds.git] / src / ui / gui / psppire-data-store.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2006, 2009  Free Software Foundation
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program 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
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 #ifndef __PSPPIRE_DATA_STORE_H__
18 #define __PSPPIRE_DATA_STORE_H__
19
20 #include "psppire-dict.h"
21
22 #define FIRST_CASE_NUMBER 1
23
24
25 G_BEGIN_DECLS
26
27 #define GTK_TYPE_DATA_STORE            (psppire_data_store_get_type ())
28
29 #define PSPPIRE_DATA_STORE(obj) \
30                      (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
31                                                                     GTK_TYPE_DATA_STORE, PsppireDataStore))
32
33 #define PSPPIRE_DATA_STORE_CLASS(klass) \
34                      (G_TYPE_CHECK_CLASS_CAST ((klass), \
35                                                                  GTK_TYPE_DATA_STORE, \
36                                                                  PsppireDataStoreClass))
37
38
39 #define PSPPIRE_IS_DATA_STORE(obj) \
40                      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DATA_STORE))
41
42 #define PSPPIRE_IS_DATA_STORE_CLASS(klass) \
43                      (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DATA_STORE))
44
45 #define PSPPIRE_DATA_STORE_GET_CLASS(obj) \
46                      (G_TYPE_INSTANCE_GET_CLASS ((obj), \
47                                                                    GTK_TYPE_DATA_STORE, \
48                                                                    PsppireDataStoreClass))
49
50 typedef struct _PsppireDataStore       PsppireDataStore;
51 typedef struct _PsppireDataStoreClass  PsppireDataStoreClass;
52
53 struct dictionary;
54
55
56 enum dict_signal_handler {
57   VARIABLE_INSERTED,
58   VARIABLE_CHANGED,
59   VARIABLE_DELETED,
60   SIZE_CHANGED,
61   n_dict_signals
62 };
63
64
65 struct datasheet;
66 struct casereader;
67
68 struct _PsppireDataStore
69 {
70   GObject parent;
71
72   /*< private >*/
73   gboolean dispose_has_run ;
74   PsppireDict *dict;
75   struct datasheet *datasheet;
76
77   gboolean show_labels;
78
79   //  gint cf_handler_id [n_cf_signals];
80   gint dict_handler_id [n_dict_signals];
81 };
82
83 struct _PsppireDataStoreClass
84 {
85   GObjectClass parent_class;
86 };
87
88
89 GType psppire_data_store_get_type (void) G_GNUC_CONST;
90 PsppireDataStore *psppire_data_store_new     (PsppireDict *dict);
91
92
93 void psppire_data_store_set_reader (PsppireDataStore *ds,
94                                     struct casereader *reader);
95
96 void psppire_data_store_set_dictionary (PsppireDataStore *data_store,
97                                         PsppireDict *dict);
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, casenumber posn);
105
106
107 gboolean psppire_data_store_delete_cases (PsppireDataStore *ds, casenumber first, casenumber count);
108
109
110 struct casereader * psppire_data_store_get_reader (PsppireDataStore *ds);
111
112 gchar * psppire_data_store_get_string (PsppireDataStore *ds,
113                                        casenumber row, glong column);
114
115 gboolean psppire_data_store_set_string (PsppireDataStore *ds,
116                                         const gchar *text,
117                                         glong row, glong column);
118
119
120 gboolean psppire_data_store_filtered (PsppireDataStore *ds,
121                                       glong row);
122
123
124 casenumber psppire_data_store_get_case_count (const PsppireDataStore *ds);
125 size_t psppire_data_store_get_value_count (const PsppireDataStore *ds);
126
127
128 \f
129
130 struct ccase *psppire_data_store_get_case (const PsppireDataStore *ds,
131                                            casenumber casenum);
132
133
134
135
136 G_END_DECLS
137
138 #endif /* __PSPPIRE_DATA_STORE_H__ */