6ef546ee55cc2a5782c0879a916ac38ce04cff6c
[pspp] / src / ui / gui / psppire-val-chooser.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2011  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_VAL_CHOOSER_H__
19 #define __PSPPIRE_VAL_CHOOSER_H__
20
21
22 #include <glib.h>
23 #include <glib-object.h>
24 #include <gtk/gtk.h>
25
26
27 G_BEGIN_DECLS
28
29 #define PSPPIRE_VAL_CHOOSER_TYPE            (psppire_val_chooser_get_type ())
30 #define PSPPIRE_VAL_CHOOSER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_VAL_CHOOSER_TYPE, PsppireValChooser))
31 #define PSPPIRE_VAL_CHOOSER_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), \
32     PSPPIRE_VAL_CHOOSER_TYPE, PsppireValChooserClass))
33 #define PSPPIRE_IS_VAL_CHOOSER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
34     PSPPIRE_VAL_CHOOSER_TYPE))
35 #define PSPPIRE_IS_VAL_CHOOSER_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
36     PSPPIRE_VAL_CHOOSER_TYPE))
37
38
39 typedef struct _PsppireValChooser       PsppireValChooser;
40 typedef struct _PsppireValChooserClass  PsppireValChooserClass;
41
42 #define n_VAL_CHOOSER_BUTTONS 7
43
44 struct range_widgets
45 {
46   GtkToggleButton *rb;
47   GtkEntry *e1;
48   GtkEntry *e2;
49 };
50
51 struct _PsppireValChooser
52 {
53   GtkFrame parent;
54
55   struct range_widgets rw [n_VAL_CHOOSER_BUTTONS];
56   gboolean input_var_is_string;
57 };
58
59 struct _PsppireValChooserClass
60 {
61   GtkTreeViewClass parent_class;
62
63 };
64
65 GType      psppire_val_chooser_get_type        (void);
66
67
68 G_END_DECLS
69
70
71 \f
72
73 enum old_value_type
74  {
75    OV_NUMERIC,
76    OV_STRING,
77    OV_SYSMIS,
78    OV_MISSING,
79    OV_RANGE,
80    OV_LOW_UP,
81    OV_HIGH_DOWN,
82    OV_ELSE
83  };
84
85 struct old_value
86  {
87    enum old_value_type type;
88    union {
89      double v;
90      gchar *s;
91      double range[2];
92    } v;
93  };
94
95 GType old_value_get_type (void);
96
97 void old_value_append_syntax (GString *str, const struct old_value *ov);
98
99 void psppire_val_chooser_get_status (PsppireValChooser *vr, struct old_value *ov);
100 void psppire_val_chooser_set_status (PsppireValChooser *vr, const struct old_value *ov);
101
102
103
104 #endif /* __PSPPIRE_VAL_CHOOSER_H__ */