Add "dictionary" property to PsppireVarStore and use it.
[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 "psppire-dict.h"
21 #include <gdk/gdk.h>
22
23 G_BEGIN_DECLS
24
25 /* PSPPIRE variable store format type, to determine whether a
26    PSPPIRE variable store contains variable input formats or
27    variable output formats.  */
28 GType psppire_var_store_format_type_get_type (void);
29
30 typedef enum
31   {
32     PSPPIRE_VAR_STORE_INPUT_FORMATS,
33     PSPPIRE_VAR_STORE_OUTPUT_FORMATS
34   }
35 PsppireVarStoreFormatType;
36
37 #define PSPPIRE_TYPE_VAR_STORE_FORMAT_TYPE \
38         (psppire_var_store_format_type_get_type ())
39
40 /* PSPPIRE variable store. */
41 #define GTK_TYPE_VAR_STORE             (psppire_var_store_get_type ())
42
43 #define PSPPIRE_VAR_STORE(obj)         (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
44                                                                     GTK_TYPE_VAR_STORE, PsppireVarStore))
45
46 #define PSPPIRE_VAR_STORE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), \
47                                                                  GTK_TYPE_VAR_STORE, \
48                                                                  PsppireVarStoreClass))
49
50 #define PSPPIRE_IS_VAR_STORE(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VAR_STORE))
51
52 #define PSPPIRE_IS_VAR_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VAR_STORE))
53
54 #define PSPPIRE_VAR_STORE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
55                                                                    GTK_TYPE_VAR_STORE, \
56                                                                    PsppireVarStoreClass))
57
58 typedef struct _PsppireVarStore       PsppireVarStore;
59 typedef struct _PsppireVarStoreClass  PsppireVarStoreClass;
60
61 struct _PsppireVarStore
62 {
63   GObject parent;
64
65   /*< private >*/
66   PsppireDict *dictionary;
67   GdkColor disabled;
68   PsppireVarStoreFormatType format_type;
69 };
70
71 struct _PsppireVarStoreClass
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 GType         psppire_var_store_get_type         (void) G_GNUC_CONST;
84 PsppireVarStore *psppire_var_store_new              (PsppireDict *dict);
85 struct variable * psppire_var_store_get_var (PsppireVarStore *store, glong row);
86
87 /* Return the number of variables */
88 gint psppire_var_store_get_var_cnt (PsppireVarStore      *var_store);
89
90 void psppire_var_store_set_font (PsppireVarStore *store, const PangoFontDescription *fd);
91
92
93 G_END_DECLS
94
95
96 enum {
97  PSPPIRE_VAR_STORE_COL_NAME,
98  PSPPIRE_VAR_STORE_COL_TYPE,
99  PSPPIRE_VAR_STORE_COL_WIDTH,
100  PSPPIRE_VAR_STORE_COL_DECIMALS,
101  PSPPIRE_VAR_STORE_COL_LABEL,
102  PSPPIRE_VAR_STORE_COL_VALUES,
103  PSPPIRE_VAR_STORE_COL_MISSING,
104  PSPPIRE_VAR_STORE_COL_COLUMNS,
105  PSPPIRE_VAR_STORE_COL_ALIGN,
106  PSPPIRE_VAR_STORE_COL_MEASURE,
107  PSPPIRE_VAR_STORE_n_COLS
108 };
109
110 #endif /* __PSPPIRE_VAR_STORE_H__ */