Change license from GPLv2+ to GPLv3+.
[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)        (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
34                                                                     GTK_TYPE_DATA_STORE, PsppireDataStore))
35
36 #define PSPPIRE_DATA_STORE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), \
37                                                                  GTK_TYPE_DATA_STORE, \
38                                                                  PsppireDataStoreClass))
39
40 #define PSPPIRE_IS_DATA_STORE(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DATA_STORE))
41
42 #define PSPPIRE_IS_DATA_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DATA_STORE))
43
44 #define PSPPIRE_DATA_STORE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
45                                                                    GTK_TYPE_DATA_STORE, \
46                                                                    PsppireDataStoreClass))
47
48 typedef struct _PsppireDataStore       PsppireDataStore;
49 typedef struct _PsppireDataStoreClass  PsppireDataStoreClass;
50
51 struct dictionary;
52
53 struct _PsppireDataStore
54 {
55   GObject parent;
56
57   /*< private >*/
58   PsppireDict *dict;
59   PsppireCaseFile *case_file;
60   const PangoFontDescription *font_desc;
61
62   /* The width of an upper case 'M' rendered in the current font */
63   gint width_of_m ;
64
65   gboolean show_labels;
66
67   /* Geometry */
68   gint margin_width;
69 };
70
71 struct _PsppireDataStoreClass
72 {
73   GObjectClass parent_class;
74
75   /* Padding for future expansion */
76   void (*_gtk_reserved1) (void);
77   void (*_gtk_reserved2) (void);
78   void (*_gtk_reserved3) (void);
79   void (*_gtk_reserved4) (void);
80 };
81
82
83 inline GType psppire_data_store_get_type (void) G_GNUC_CONST;
84 PsppireDataStore *psppire_data_store_new     (PsppireDict *dict);
85
86 void psppire_data_store_set_case_file (PsppireDataStore *data_store,
87                                        PsppireCaseFile *cf);
88
89 void psppire_data_store_set_dictionary (PsppireDataStore *data_store,
90                                         PsppireDict *dict);
91
92 void psppire_data_store_set_font (PsppireDataStore *store,
93                                  const PangoFontDescription *fd);
94
95 void psppire_data_store_show_labels (PsppireDataStore *store,
96                                     gboolean show_labels);
97
98 void psppire_data_store_clear (PsppireDataStore *data_store);
99
100 gboolean psppire_data_store_insert_new_case (PsppireDataStore *ds, gint posn);
101
102 struct casereader * psppire_data_store_get_reader (PsppireDataStore *ds);
103
104 gchar * psppire_data_store_get_string (PsppireDataStore *ds,
105                                        gint row, gint column);
106
107 gboolean psppire_data_store_set_string (PsppireDataStore *ds,
108                                         const gchar *text,
109                                         gint row, gint column);
110
111 #ifdef __cplusplus
112 }
113 #endif /* __cplusplus */
114
115
116 #endif /* __PSPPIRE_DATA_STORE_H__ */