Fixed bug reporting the significance of paired value t-test.
[pspp-builds.git] / src / ui / gui / psppire-data-store.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2006  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 <gtksheet/gsheetmodel.h>
21 #include "psppire-dict.h"
22 #include "psppire-case-file.h"
23
24 #define FIRST_CASE_NUMBER 1
25
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30
31 #define GTK_TYPE_DATA_STORE            (psppire_data_store_get_type ())
32
33 #define PSPPIRE_DATA_STORE(obj) \
34                      (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
35                                                                     GTK_TYPE_DATA_STORE, PsppireDataStore))
36
37 #define PSPPIRE_DATA_STORE_CLASS(klass) \
38                      (G_TYPE_CHECK_CLASS_CAST ((klass), \
39                                                                  GTK_TYPE_DATA_STORE, \
40                                                                  PsppireDataStoreClass))
41
42
43 #define PSPPIRE_IS_DATA_STORE(obj) \
44                      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DATA_STORE))
45
46 #define PSPPIRE_IS_DATA_STORE_CLASS(klass) \
47                      (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DATA_STORE))
48
49 #define PSPPIRE_DATA_STORE_GET_CLASS(obj) \
50                      (G_TYPE_INSTANCE_GET_CLASS ((obj), \
51                                                                    GTK_TYPE_DATA_STORE, \
52                                                                    PsppireDataStoreClass))
53
54 typedef struct _PsppireDataStore       PsppireDataStore;
55 typedef struct _PsppireDataStoreClass  PsppireDataStoreClass;
56
57 struct dictionary;
58
59
60 enum cf_signal_handler {
61   CASES_DELETED,
62   CASE_INSERTED,
63   CASE_CHANGED,
64   n_cf_signals
65 };
66
67
68 enum dict_signal_handler {
69   VARIABLE_INSERTED,
70   VARIABLE_CHANGED,
71   VARIABLE_DELETED,
72   SIZE_CHANGED,
73   n_dict_signals
74 };
75
76 void do_this_thing (PsppireDict *, struct dictionary *, void *);
77
78
79 struct _PsppireDataStore
80 {
81   GObject parent;
82
83   /*< private >*/
84   gboolean dispose_has_run ;
85   PsppireDict *dict;
86   PsppireCaseFile *case_file;
87   const PangoFontDescription *font_desc;
88
89   /* The width of an upper case 'M' rendered in the current font */
90   gint width_of_m ;
91
92   gboolean show_labels;
93
94   /* Geometry */
95   gint margin_width;
96
97   gint cf_handler_id [n_cf_signals];
98   gint dict_handler_id [n_dict_signals];
99 };
100
101 struct _PsppireDataStoreClass
102 {
103   GObjectClass parent_class;
104
105   /* Padding for future expansion */
106   void (*_gtk_reserved1) (void);
107   void (*_gtk_reserved2) (void);
108   void (*_gtk_reserved3) (void);
109   void (*_gtk_reserved4) (void);
110 };
111
112
113 inline GType psppire_data_store_get_type (void) G_GNUC_CONST;
114 PsppireDataStore *psppire_data_store_new     (PsppireDict *dict);
115
116 void psppire_data_store_set_case_file (PsppireDataStore *data_store,
117                                        PsppireCaseFile *cf);
118
119 void psppire_data_store_set_dictionary (PsppireDataStore *data_store,
120                                         PsppireDict *dict);
121
122 void psppire_data_store_set_font (PsppireDataStore *store,
123                                  const PangoFontDescription *fd);
124
125 void psppire_data_store_show_labels (PsppireDataStore *store,
126                                     gboolean show_labels);
127
128 void psppire_data_store_clear (PsppireDataStore *data_store);
129
130 gboolean psppire_data_store_insert_new_case (PsppireDataStore *ds, casenumber posn);
131
132
133 gboolean psppire_data_store_delete_cases (PsppireDataStore *ds, casenumber first, casenumber count);
134
135
136 struct casereader * psppire_data_store_get_reader (PsppireDataStore *ds);
137
138 gchar * psppire_data_store_get_string (PsppireDataStore *ds,
139                                        casenumber row, glong column);
140
141 gboolean psppire_data_store_set_string (PsppireDataStore *ds,
142                                         const gchar *text,
143                                         glong row, glong column);
144
145 inline casenumber psppire_data_store_get_case_count (const PsppireDataStore *ds);
146 size_t psppire_data_store_get_value_count (const PsppireDataStore *ds);
147
148 #ifdef __cplusplus
149 }
150 #endif /* __cplusplus */
151
152
153 #endif /* __PSPPIRE_DATA_STORE_H__ */