8b67e425d913f0e56b5ae4dbd6f9a5c354804b95
[pspp] / src / ui / gui / psppire-dialog-action-recode.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2012  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 #include <glib-object.h>
19 #include <glib.h>
20
21 #include "psppire-dialog-action.h"
22
23 #ifndef __PSPPIRE_DIALOG_ACTION_RECODE_H__
24 #define __PSPPIRE_DIALOG_ACTION_RECODE_H__
25
26 G_BEGIN_DECLS
27
28 enum
29   {
30     BUTTON_NEW_VALUE,
31     BUTTON_NEW_COPY,
32     BUTTON_NEW_SYSMIS,
33     n_BUTTONS
34   };
35
36 #define PSPPIRE_TYPE_DIALOG_ACTION_RECODE (psppire_dialog_action_recode_get_type ())
37
38 #define PSPPIRE_DIALOG_ACTION_RECODE(obj)       \
39                      (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
40                                                   PSPPIRE_TYPE_DIALOG_ACTION_RECODE, PsppireDialogActionRecode))
41
42 #define PSPPIRE_DIALOG_ACTION_RECODE_CLASS(klass) \
43                      (G_TYPE_CHECK_CLASS_CAST ((klass), \
44                                  PSPPIRE_TYPE_DIALOG_ACTION_RECODE, \
45                                  PsppireDialogActionRecodeClass))
46
47
48 #define PSPPIRE_IS_DIALOG_ACTION_RECODE(obj) \
49                      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_RECODE))
50
51 #define PSPPIRE_IS_DIALOG_ACTION_RECODE_CLASS(klass) \
52                      (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_RECODE))
53
54
55 #define PSPPIRE_DIALOG_ACTION_RECODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
56                                    PSPPIRE_TYPE_DIALOG_ACTION_RECODE, \
57                                    PsppireDialogActionRecodeClass))
58
59 typedef struct _PsppireDialogActionRecode       PsppireDialogActionRecode;
60 typedef struct _PsppireDialogActionRecodeClass  PsppireDialogActionRecodeClass;
61
62
63 struct _PsppireDialogActionRecode
64 {
65   PsppireDialogAction parent;
66
67   PsppireDialog *old_and_new_dialog;
68
69   GtkWidget *dict_treeview;
70   GtkWidget *variable_treeview;
71   GtkWidget *toggle[n_BUTTONS];
72
73   GtkWidget *strings_box;
74   GtkWidget *convert_button;
75   GtkWidget *new_copy_label;
76
77
78   GtkWidget *new_value_entry;
79
80   GtkWidget *old_value_chooser;
81
82   GtkListStore *value_map;
83
84   GtkWidget *acr;
85
86   gboolean input_var_is_string;
87
88   GtkWidget *new_name_entry;
89   GtkWidget *new_label_entry;
90   GtkWidget *change_button;
91
92   GtkWidget *output_variable_box;
93
94   GtkWidget *string_button;
95   GtkWidget *width_entry;
96 };
97
98
99 struct _PsppireDialogActionRecodeClass
100 {
101   PsppireDialogActionClass parent_class;
102
103   gboolean (*target_is_string) (const PsppireDialogActionRecode *);
104 };
105
106 GType psppire_dialog_action_recode_get_type (void) ;
107
108 void psppire_dialog_action_recode_refresh (PsppireDialogAction *);
109
110 void psppire_dialog_action_recode_pre_activate (PsppireDialogActionRecode *act, void (*populate_treeview) (PsppireDialogActionRecode *) );
111
112
113 GType new_value_get_type (void);
114
115
116 char *psppire_dialog_action_recode_generate_syntax (const PsppireDialogAction *act,
117                                                     void (*add_string_decls) (const PsppireDialogActionRecode *, struct string *),
118                                                     void (*add_into_clause) (const PsppireDialogActionRecode *, struct string *),
119                                                     void (*add_new_value_labels) (const PsppireDialogActionRecode *, struct string *));
120
121 G_END_DECLS
122
123 #endif /* __PSPPIRE_DIALOG_ACTION_RECODE_H__ */