Patch #6426. Reviewed by John Darrington.
[pspp-builds.git] / src / ui / gui / psppire-var-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_VAR_STORE_H__
18 #define __PSPPIRE_VAR_STORE_H__
19
20 #include <gtksheet/gsheetmodel.h>
21 #include "psppire-dict.h"
22 #include <gdk/gdk.h>
23
24 G_BEGIN_DECLS
25
26 /* PSPPIRE variable store format type, to determine whether a
27    PSPPIRE variable store contains variable input formats or
28    variable output formats.  */
29 GType psppire_var_store_format_type_get_type (void);
30
31 typedef enum
32   {
33     PSPPIRE_VAR_STORE_INPUT_FORMATS,
34     PSPPIRE_VAR_STORE_OUTPUT_FORMATS
35   }
36 PsppireVarStoreFormatType;
37
38 #define G_TYPE_PSPPIRE_VAR_STORE_FORMAT_TYPE \
39         (psppire_var_store_format_type_get_type ())
40
41 /* PSPPIRE variable store. */
42 #define GTK_TYPE_VAR_STORE             (psppire_var_store_get_type ())
43
44 #define PSPPIRE_VAR_STORE(obj)         (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
45                                                                     GTK_TYPE_VAR_STORE, PsppireVarStore))
46
47 #define PSPPIRE_VAR_STORE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), \
48                                                                  GTK_TYPE_VAR_STORE, \
49                                                                  PsppireVarStoreClass))
50
51 #define PSPPIRE_IS_VAR_STORE(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VAR_STORE))
52
53 #define PSPPIRE_IS_VAR_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VAR_STORE))
54
55 #define PSPPIRE_VAR_STORE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
56                                                                    GTK_TYPE_VAR_STORE, \
57                                                                    PsppireVarStoreClass))
58
59 typedef struct _PsppireVarStore       PsppireVarStore;
60 typedef struct _PsppireVarStoreClass  PsppireVarStoreClass;
61
62 struct _PsppireVarStore
63 {
64   GObject parent;
65
66   /*< private >*/
67   PsppireDict *dict;
68   GdkColor disabled;
69   const PangoFontDescription *font_desc;
70   gint trailing_rows;
71   PsppireVarStoreFormatType format_type;
72 };
73
74 struct _PsppireVarStoreClass
75 {
76   GObjectClass parent_class;
77
78   /* Padding for future expansion */
79   void (*_gtk_reserved1) (void);
80   void (*_gtk_reserved2) (void);
81   void (*_gtk_reserved3) (void);
82   void (*_gtk_reserved4) (void);
83 };
84
85
86 GType         psppire_var_store_get_type         (void) G_GNUC_CONST;
87 PsppireVarStore *psppire_var_store_new              (PsppireDict *dict);
88 struct variable * psppire_var_store_get_var (PsppireVarStore *store, glong row);
89
90 void psppire_var_store_set_dictionary (PsppireVarStore *var_store, PsppireDict *dict);
91
92
93 /* Return the number of variables */
94 gint psppire_var_store_get_var_cnt (PsppireVarStore      *var_store);
95
96 void psppire_var_store_set_font (PsppireVarStore *store, const PangoFontDescription *fd);
97
98
99 G_END_DECLS
100
101 #endif /* __PSPPIRE_VAR_STORE_H__ */