gui: Redo var sheet, data sheet, text import with PsppSheetView.
[pspp] / src / ui / gui / psppire-data-editor.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2008, 2010, 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_DATA_EDITOR_H__
18 #define __PSPPIRE_DATA_EDITOR_H__
19
20 /* PsppireDataEditor is a GtkNotebook for editing a single PSPP dataset.
21
22    PsppireDataEditor has two tabs that normally contain a PsppireDataSheet and
23    a PsppireVarSheet.  The user can choose to "split" the PsppireDataSheet view
24    into four views within the single tab.  PsppireDataEditor also adds some
25    decorations above the PsppireDataSheet to note the current cell and allow
26    the current cell to be edited.
27
28    PsppireDataEditor's normal parent in the widget hierarchy is
29    PsppireDataWindow. */
30
31 #include <glib.h>
32 #include <glib-object.h>
33 #include <gtk/gtk.h>
34
35 #include "psppire-var-store.h"
36 #include "psppire-data-store.h"
37 #include "ui/gui/pspp-sheet-view.h"
38
39 G_BEGIN_DECLS
40
41 #define PSPPIRE_DATA_EDITOR_TYPE            (psppire_data_editor_get_type ())
42 #define PSPPIRE_DATA_EDITOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_DATA_EDITOR_TYPE, PsppireDataEditor))
43 #define PSPPIRE_DATA_EDITOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PSPPIRE_DATA_EDITOR_TYPE, PsppireDataEditorClass))
44 #define PSPPIRE_IS_DATA_EDITOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_DATA_EDITOR_TYPE))
45 #define PSPPIRE_IS_DATA_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_DATA_EDITOR_TYPE))
46
47
48 typedef struct _PsppireDataEditor       PsppireDataEditor;
49 typedef struct _PsppireDataEditorClass  PsppireDataEditorClass;
50
51 /* All members are private. */
52 struct _PsppireDataEditor
53 {
54   GtkNotebook parent;
55
56   /* <private> */
57   PsppireDataStore *data_store;
58   PsppireVarStore *var_store;
59
60   /* Font to use in var sheet and data sheet(s), NULL to use system default. */
61   struct _PangoFontDescription *font;
62
63   /* Variable sheet tab. */
64   GtkWidget *var_sheet;
65
66   /* Data sheet tab. */
67   GtkWidget *vbox;             /* Top-level widget in tab. */
68   GtkWidget *cell_ref_label;   /* GtkLabel that shows selected case and var. */
69   GtkWidget *datum_entry;      /* GtkComboBoxEntry for editing current cell. */
70   GtkWidget *datasheet_vbox_widget; /* ->vbox child that holds data sheets. */
71   GtkWidget *data_sheets[4];   /* Normally one data sheet; four, if split. */
72   gboolean split;              /* True if data sheets are split. */
73
74   /* UI manager for whichever var or data sheet is currently in use. */
75   GtkUIManager *ui_manager;
76 };
77
78 struct _PsppireDataEditorClass
79 {
80   GtkNotebookClass parent_class;
81 };
82
83
84 GType          psppire_data_editor_get_type        (void);
85 GtkWidget*     psppire_data_editor_new             (PsppireVarStore *, PsppireDataStore *);
86 void           psppire_data_editor_show_grid       (PsppireDataEditor *, gboolean);
87 void           psppire_data_editor_set_font        (PsppireDataEditor *, PangoFontDescription *);
88 void           psppire_data_editor_split_window    (PsppireDataEditor *, gboolean );
89
90 void           psppire_data_editor_goto_variable   (PsppireDataEditor *, gint dict_index);
91
92 struct _PsppireDataSheet *psppire_data_editor_get_active_data_sheet (PsppireDataEditor *);
93
94 GtkUIManager *psppire_data_editor_get_ui_manager (PsppireDataEditor *);
95
96 enum {PSPPIRE_DATA_EDITOR_DATA_VIEW = 0, PSPPIRE_DATA_EDITOR_VARIABLE_VIEW};
97
98 G_END_DECLS
99
100 #endif /* __PSPPIRE_DATA_EDITOR_H__ */