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_from_dict (struct dictionary *d);
70 void psppire_dict_set_name (PsppireDict* s, gint idx, const gchar *name);
71 void psppire_dict_delete_var (PsppireDict *s, gint idx);
73 /* Return the number of variables in the dictionary */
74 gint psppire_dict_get_var_cnt (const PsppireDict *d);
76 /* Return a variable by name.
77 Return NULL if it doesn't exist
79 struct variable * psppire_dict_lookup_var (const PsppireDict *d, const gchar *name);
81 /* Tell the dictionary that one of its variable has changed */
82 void psppire_dict_var_changed (PsppireDict *d, gint idx);
85 /* Clears the contents of D */
86 void psppire_dict_clear (PsppireDict *d);
88 /* Return the IDXth variable */
90 struct variable * psppire_dict_get_variable (PsppireDict *d, gint idx);
92 /* Delete N variables beginning at FIRST */
93 void psppire_dict_delete_variables (PsppireDict *d, gint first, gint n);
95 /* Insert a new variable at posn IDX */
96 void psppire_dict_insert_variable (PsppireDict *d, gint idx, const gchar *name);
98 void psppire_dict_resize_variable (PsppireDict *,
99 const struct variable *,
102 gboolean psppire_dict_check_name (const PsppireDict *dict,
103 const gchar *name, gboolean report);
105 gint psppire_dict_get_next_value_idx (const PsppireDict *dict);
107 void psppire_dict_rename_var (PsppireDict *dict, struct variable *v,
113 #endif /* __PSPPIRE_DICT_H__ */