Merge "master" into "psppsheet" to obtain bug fixes from "master".
[pspp] / src / ui / gui / psppire-var-sheet.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2008, 2011, 2012 Free Software Foundation, Inc.
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_VAR_SHEET_H__
18 #define __PSPPIRE_VAR_SHEET_H__
19
20 /* PsppireVarSheet is a PsppSheetView that displays the variables in a
21    dictionary, one variable per row.
22
23    PsppireDataSheet is usually a child of PsppireDataEditor in the widget
24    hierarchy.  Other widgets can also use it. */
25
26 #include <gtk/gtk.h>
27 #include "data/format.h"
28 #include "ui/gui/pspp-sheet-view.h"
29
30
31 G_BEGIN_DECLS
32
33 #define PSPPIRE_TYPE_FMT_USE (psppire_fmt_use_get_type ())
34
35 GType psppire_fmt_use_get_type (void) G_GNUC_CONST;
36 \f
37 #define PSPPIRE_VAR_SHEET_TYPE            (psppire_var_sheet_get_type ())
38 #define PSPPIRE_VAR_SHEET(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_VAR_SHEET_TYPE, PsppireVarSheet))
39 #define PSPPIRE_VAR_SHEET_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PSPPIRE_VAR_SHEET_TYPE, PsppireVarSheetClass))
40 #define PSPPIRE_IS_VAR_SHEET(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_VAR_SHEET_TYPE))
41 #define PSPPIRE_IS_VAR_SHEET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_VAR_SHEET_TYPE))
42
43
44 typedef struct _PsppireVarSheet       PsppireVarSheet;
45 typedef struct _PsppireVarSheetClass  PsppireVarSheetClass;
46
47 enum
48 {
49     PSPPIRE_VAR_SHEET_BACKEND_CHANGED,
50     PSPPIRE_VAR_SHEET_VARIABLE_INSERTED,
51     PSPPIRE_VAR_SHEET_VARIABLE_DELETED,
52     PSPPIRE_VAR_SHEET_N_SIGNALS
53  };
54
55 struct _PsppireVarSheet
56 {
57   PsppSheetView parent;
58
59   gboolean may_create_vars;
60   gboolean may_delete_vars;
61   enum fmt_use format_use;
62
63   struct _PsppireDict *dict;
64   struct val_labs_dialog *val_labs_dialog;
65   struct missing_val_dialog *missing_val_dialog;
66   struct var_type_dialog *var_type_dialog;
67
68   gulong scroll_to_bottom_signal;
69   gulong dict_signals[PSPPIRE_VAR_SHEET_N_SIGNALS];
70
71   GtkBuilder *builder;
72
73   GtkWidget *container;
74   gulong on_switch_page_handler;
75
76   GtkUIManager *uim;
77
78   gboolean dispose_has_run;
79 };
80
81 struct _PsppireVarSheetClass
82 {
83   PsppSheetViewClass parent_class;
84 };
85
86 GType          psppire_var_sheet_get_type        (void);
87 GtkWidget*     psppire_var_sheet_new             (void);
88
89 struct _PsppireDict *psppire_var_sheet_get_dictionary (PsppireVarSheet *);
90 void psppire_var_sheet_set_dictionary (PsppireVarSheet *,
91                                        struct _PsppireDict *);
92
93 gboolean psppire_var_sheet_get_may_create_vars (PsppireVarSheet *);
94 void psppire_var_sheet_set_may_create_vars (PsppireVarSheet *, gboolean);
95
96 gboolean psppire_var_sheet_get_may_delete_vars (PsppireVarSheet *);
97 void psppire_var_sheet_set_may_delete_vars (PsppireVarSheet *, gboolean);
98
99 void psppire_var_sheet_goto_variable (PsppireVarSheet *, int dict_index);
100
101 GtkUIManager *psppire_var_sheet_get_ui_manager (PsppireVarSheet *);
102
103 G_END_DECLS
104
105 #endif /* __PSPPIRE_VAR_SHEET_H__ */