val-labs-dialog: Convert to a GObject.
[pspp] / src / ui / gui / val-labs-dialog.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2005, 2011, 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 #ifndef PSPPIRE_VAL_LABS_DIALOG_H
18 #define PSPPIRE_VAL_LABS_DIALOG_H
19
20
21 /*  This module describes the behaviour of the Value Labels dialog box,
22     used for input of the value labels in the variable sheet */
23
24
25 #include <gtk/gtk.h>
26 #include "data/format.h"
27 #include "data/variable.h"
28 #include "ui/gui/psppire-dialog.h"
29 #include "ui/gui/psppire-var-store.h"
30
31 G_BEGIN_DECLS
32
33 #define PSPPIRE_TYPE_VAL_LABS_DIALOG             (psppire_val_labs_dialog_get_type())
34 #define PSPPIRE_VAL_LABS_DIALOG(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj),PSPPIRE_TYPE_VAL_LABS_DIALOG,PsppireValLabsDialog))
35 #define PSPPIRE_VAL_LABS_DIALOG_CLASS(class)     (G_TYPE_CHECK_CLASS_CAST ((class),PSPPIRE_TYPE_VAL_LABS_DIALOG,PsppireValLabsDialogClass))
36 #define PSPPIRE_IS_VAL_LABS_DIALOG(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj),PSPPIRE_TYPE_VAL_LABS_DIALOG))
37 #define PSPPIRE_IS_VAL_LABS_DIALOG_CLASS(class)  (G_TYPE_CHECK_CLASS_TYPE ((class),PSPPIRE_TYPE_VAL_LABS_DIALOG))
38 #define PSPPIRE_VAL_LABS_DIALOG_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj),PSPPIRE_TYPE_VAL_LABS_DIALOG,PsppireValLabsDialogClass))
39
40 typedef struct _PsppireValLabsDialog      PsppireValLabsDialog;
41 typedef struct _PsppireValLabsDialogClass PsppireValLabsDialogClass;
42
43 struct _PsppireValLabsDialog {
44   PsppireDialog parent;
45
46   GtkWidget *window;
47
48   struct val_labs *labs;
49   gchar *encoding;
50   struct fmt_spec format;
51
52   /* Actions */
53   GtkWidget *add_button;
54   GtkWidget *remove_button;
55   GtkWidget *change_button;
56
57   /* Entry Boxes */
58   GtkWidget *value_entry;
59   GtkWidget *label_entry;
60
61   /* Signal handler ids */
62   gint change_handler_id;
63   gint value_handler_id;
64
65   GtkWidget *treeview;
66 };
67
68 struct _PsppireValLabsDialogClass {
69   PsppireDialogClass parent_class;
70 };
71
72 GType psppire_val_labs_dialog_get_type (void) G_GNUC_CONST;
73 PsppireValLabsDialog* psppire_val_labs_dialog_new (const struct variable *);
74
75 void psppire_val_labs_dialog_set_variable (PsppireValLabsDialog *,
76                                            const struct variable *);
77 const struct val_labs *psppire_val_labs_dialog_get_value_labels (
78   const PsppireValLabsDialog *);
79
80 struct val_labs *psppire_val_labs_dialog_run (GtkWindow *parent_window,
81                                               const struct variable *);
82
83 G_END_DECLS
84
85 #endif /* psppire-val-labs-dialog.h */