165ba03aee18a60bd5ea89a7f3457c05d8c9822c
[pspp-builds.git] / src / ui / gui / sheet / psppire-axis.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2008, 2009  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
18 #ifndef PSPPIRE_AXIS_H__
19 #define PSPPIRE_AXIS_H__
20
21
22 #include <glib-object.h>
23 #include <glib.h>
24 #include <libpspp/tower.h>
25
26 G_BEGIN_DECLS
27
28
29 /* --- type macros --- */
30 #define G_TYPE_PSPPIRE_AXIS              (psppire_axis_get_type ())
31 #define PSPPIRE_AXIS(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_PSPPIRE_AXIS, PsppireAxis))
32 #define PSPPIRE_AXIS_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_PSPPIRE_AXIS, PsppireAxisClass))
33 #define PSPPIRE_IS_AXIS(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_PSPPIRE_AXIS))
34 #define PSPPIRE_IS_AXIS_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_PSPPIRE_AXIS))
35 #define PSPPIRE_AXIS_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_PSPPIRE_AXIS, PsppireAxisClass))
36
37
38
39 /* --- typedefs & structures --- */
40 typedef struct _PsppireAxis        PsppireAxis;
41 typedef struct _PsppireAxisClass PsppireAxisClass;
42
43 struct pool;
44
45 struct _PsppireAxis
46 {
47   GObject  parent;
48
49   struct tower pixel_tower;
50   struct tower unit_tower;
51
52   struct pool *pool;
53
54   glong min_extent;
55   gint default_size;
56   gint padding;
57   GMutex *mutex;
58 };
59
60 struct _PsppireAxisClass
61 {
62   GObjectClass parent_class;
63 };
64
65 GType          psppire_axis_get_type (void);
66
67 PsppireAxis*   psppire_axis_new (void);
68
69 \f
70 /* Interface between axis and model */
71
72 void psppire_axis_insert (PsppireAxis *a, gint posn, gint size);
73
74 void psppire_axis_append (PsppireAxis *a, gint size);
75
76 void psppire_axis_append_n (PsppireAxis *a, gint n_units, gint size);
77
78 void psppire_axis_resize (PsppireAxis *a, gint posn, glong size);
79
80 void psppire_axis_clear (PsppireAxis *);
81
82 void psppire_axis_delete (PsppireAxis *, gint first, gint n_cases);
83
84 \f
85
86 gint  psppire_axis_unit_count (const PsppireAxis *);
87 glong psppire_axis_start_pixel (const PsppireAxis *a, gint unit);
88 gint  psppire_axis_unit_size (const PsppireAxis *a, gint unit);
89 gint  psppire_axis_unit_at_pixel (const PsppireAxis *a, glong pixel);
90
91 G_END_DECLS
92
93 #endif /* PSPPIRE_AXIS_H__ */