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   GtkLabel *label;
47   GtkToggleButton *rb;
48   GtkEntry *e1;
49   GtkEntry *e2;
50 };
51 
52 struct _PsppireValChooser
53 {
54   GtkFrame parent;
55 
56   struct range_widgets rw [n_VAL_CHOOSER_BUTTONS];
57   gboolean input_var_is_string;
58 };
59 
60 struct _PsppireValChooserClass
61 {
62   GtkTreeViewClass parent_class;
63 
64 };
65 
66 GType      psppire_val_chooser_get_type        (void);
67 
68 
69 G_END_DECLS
70 
71 
72 
73 
74 enum old_value_type
75  {
76    OV_NUMERIC,
77    OV_STRING,
78    OV_SYSMIS,
79    OV_MISSING,
80    OV_RANGE,
81    OV_LOW_UP,
82    OV_HIGH_DOWN,
83    OV_ELSE
84  };
85 
86 struct old_value
87  {
88    enum old_value_type type;
89    union {
90      double v;
91      gchar *s;
92      double range[2];
93    } v;
94  };
95 
96 GType old_value_get_type (void);
97 
98 struct string;
99 void old_value_append_syntax (struct string *str, const struct old_value *ov);
100 
101 void psppire_val_chooser_get_status (PsppireValChooser *vr, struct old_value *ov);
102 void psppire_val_chooser_set_status (PsppireValChooser *vr, const struct old_value *ov);
103 
104 
105 
106 #endif /* __PSPPIRE_VAL_CHOOSER_H__ */
107