Actually commit the icons
[pspp-builds.git] / src / ui / gui / psppire-case-array.h
1 /* 
2     PSPPIRE --- A Graphical User Interface for PSPP
3     Copyright (C) 2004  Free Software Foundation
4     Written by John Darrington
5
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19     02110-1301, USA. */
20
21
22 #ifndef __CASE_ARRAY_H__
23 #define __CASE_ARRAY_H__
24
25
26 #include <glib-object.h>
27 #include <glib.h>
28
29
30
31 G_BEGIN_DECLS
32
33
34 /* --- type macros --- */
35 #define G_TYPE_PSPPIRE_CASE_ARRAY              (psppire_case_array_get_type ())
36 #define PSPPIRE_CASE_ARRAY(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_PSPPIRE_CASE_ARRAY, PsppireCaseArray))
37 #define PSPPIRE_CASE_ARRAY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_PSPPIRE_CASE_ARRAY, PsppireCaseArrayClass))
38 #define G_IS_PSPPIRE_CASE_ARRAY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_PSPPIRE_CASE_ARRAY))
39 #define G_IS_PSPPIRE_CASE_ARRAY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_PSPPIRE_CASE_ARRAY))
40 #define PSPPIRE_CASE_ARRAY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_PSPPIRE_CASE_ARRAY, PsppireCaseArrayClass))
41
42
43
44
45 /* --- typedefs & structures --- */
46 typedef struct _PsppireCaseArray           PsppireCaseArray;
47 typedef struct _PsppireCaseArrayClass PsppireCaseArrayClass;
48
49 struct ccase;
50
51 struct _PsppireCaseArray
52 {
53   GObject             parent;
54
55   struct ccase *cases;
56   gint capacity;
57   gint width;
58   gint size;
59 };
60
61
62 struct _PsppireCaseArrayClass
63 {
64   GObjectClass parent_class;
65 };
66
67
68 /* -- PsppireCaseArray --- */
69 GType          psppire_case_array_get_type (void);
70
71 PsppireCaseArray *psppire_case_array_new (gint capacity, gint width);
72
73 void psppire_case_array_resize(PsppireCaseArray *ca,  gint new_size);
74
75
76 void psppire_case_array_delete_cases(PsppireCaseArray *ca, gint first, gint n_cases);
77
78
79 typedef gboolean psppire_case_array_fill_case_func(struct ccase *, gpointer aux);
80
81 typedef gboolean psppire_case_array_use_case_func(const struct ccase *, gpointer aux);
82
83 gboolean psppire_case_array_insert_case(PsppireCaseArray *ca, gint posn,
84                                         psppire_case_array_fill_case_func fill_case_func,
85                                         gpointer aux);
86
87 inline gboolean psppire_case_array_append_case(PsppireCaseArray *ca, 
88                                         psppire_case_array_fill_case_func fill_case_func,
89                                         gpointer aux);
90
91
92 gboolean psppire_case_array_iterate_case(PsppireCaseArray *ca, 
93                                   psppire_case_array_use_case_func fill_case_func,
94                                   gpointer aux);
95
96
97
98 gint psppire_case_array_get_n_cases(const PsppireCaseArray *ca);
99
100
101 /* Clears the contents of CA */
102 void psppire_case_array_clear(PsppireCaseArray *ca);
103
104
105 const union value * psppire_case_array_get_value(const PsppireCaseArray *ca, 
106                                               gint c, gint idx);
107
108
109 typedef gboolean value_fill_func_t(union value *v, gpointer data);
110
111 void psppire_case_array_set_value(PsppireCaseArray *ca, gint c, gint idx,
112                                value_fill_func_t ff,
113                                gpointer data);
114
115 G_END_DECLS
116
117 #endif /* __PSPPIRE_CASE_ARRAY_H__ */