2 PSPPIRE --- A Graphical User Interface for PSPP
3 Copyright (C) 2004 Free Software Foundation
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 #ifndef __PSPPIRE_DICT_H__
22 #define __PSPPIRE_DICT_H__
25 #include <glib-object.h>
28 #include <data/dictionary.h>
29 #include <data/variable.h>
35 /* --- type macros --- */
36 #define G_TYPE_PSPPIRE_DICT (psppire_dict_get_type ())
37 #define PSPPIRE_DICT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_PSPPIRE_DICT, PsppireDict))
38 #define PSPPIRE_DICT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_PSPPIRE_DICT, PsppireDictClass))
39 #define G_IS_PSPPIRE_DICT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_PSPPIRE_DICT))
40 #define G_IS_PSPPIRE_DICT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_PSPPIRE_DICT))
41 #define PSPPIRE_DICT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_PSPPIRE_DICT, PsppireDictClass))
45 /* --- typedefs & structures --- */
46 typedef struct _PsppireDict PsppireDict;
47 typedef struct _PsppireDictClass PsppireDictClass;
49 enum {DICT_TVM_COL_NAME=0, DICT_TVM_COL_VAR, n_DICT_COLS} ;
54 struct dictionary *dict;
56 /* For GtkTreeModelIface */
60 struct _PsppireDictClass
62 GObjectClass parent_class;
67 /* -- PsppireDict --- */
68 GType psppire_dict_get_type (void);
69 PsppireDict* psppire_dict_new (void);
70 PsppireDict* psppire_dict_new_from_dict (struct dictionary *d);
71 void psppire_dict_set_name (PsppireDict* s, gint idx, const gchar *name);
72 void psppire_dict_delete_var (PsppireDict *s, gint idx);
74 /* Return the number of variables in the dictionary */
75 gint psppire_dict_get_var_cnt(const PsppireDict *d);
77 /* Return a variable by name.
78 Return NULL if it doesn't exist
80 struct variable * psppire_dict_lookup_var (const PsppireDict *d, const gchar *name);
82 /* Tell the dictionary that one of its variable has changed */
83 void psppire_dict_var_changed(PsppireDict *d, gint idx);
86 /* Clears the contents of D */
87 void psppire_dict_clear(PsppireDict *d);
89 /* Return the IDXth variable */
91 struct variable * psppire_dict_get_variable (PsppireDict *d, gint idx);
93 /* Delete N variables beginning at FIRST */
94 void psppire_dict_delete_variables(PsppireDict *d, gint first, gint n);
96 /* Insert a new variable at posn IDX */
97 void psppire_dict_insert_variable(PsppireDict *d, gint idx, const gchar *name);
99 void psppire_dict_resize_variable(PsppireDict *,
100 const struct variable *,
103 gboolean psppire_dict_check_name(const PsppireDict *dict,
104 const gchar *name, gboolean report);
106 gint psppire_dict_get_next_value_idx (const PsppireDict *dict);
108 void psppire_dict_rename_var (PsppireDict *dict, struct variable *v,
114 #endif /* __PSPPIRE_DICT_H__ */