Whitespace changes
[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-data-store.h"
36
37 G_BEGIN_DECLS
38
39 #define PSPPIRE_DATA_EDITOR_TYPE            (psppire_data_editor_get_type ())
40 #define PSPPIRE_DATA_EDITOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_DATA_EDITOR_TYPE, PsppireDataEditor))
41 #define PSPPIRE_DATA_EDITOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PSPPIRE_DATA_EDITOR_TYPE, PsppireDataEditorClass))
42 #define PSPPIRE_IS_DATA_EDITOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_DATA_EDITOR_TYPE))
43 #define PSPPIRE_IS_DATA_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_DATA_EDITOR_TYPE))
44
45
46 typedef struct _PsppireDataEditor       PsppireDataEditor;
47 typedef struct _PsppireDataEditorClass  PsppireDataEditorClass;
48
49 /* All members are private. */
50 struct _PsppireDataEditor
51 {
52   GtkNotebook parent;
53
54   /* <private> */
55   PsppireDataStore *data_store;
56   PsppireDict *dict;
57
58   /* Font to use in var sheet and data sheet(s), NULL to use system default. */
59   struct _PangoFontDescription *font;
60
61   /* Variable sheet tab. */
62   GtkWidget *var_sheet;
63   GtkWidget *data_sheet;
64
65   /* Data sheet tab. */
66   GtkWidget *vbox;             /* Top-level widget in tab. */
67   GtkWidget *cell_ref_label;   /* GtkLabel that shows selected case and var. */
68   GtkWidget *datum_entry;      /* PsppireValueEntry for editing current cell. */
69
70   gboolean split;              /* True if the sheets are in split view. */
71 };
72
73 struct _PsppireDataEditorClass
74 {
75   GtkNotebookClass parent_class;
76 };
77
78
79 GType          psppire_data_editor_get_type        (void);
80 GtkWidget*     psppire_data_editor_new             (PsppireDict *, PsppireDataStore *);
81 void           psppire_data_editor_show_grid       (PsppireDataEditor *, gboolean);
82 void           psppire_data_editor_set_font        (PsppireDataEditor *, PangoFontDescription *);
83 void           psppire_data_editor_split_window    (PsppireDataEditor *, gboolean );
84
85 void psppire_data_editor_goto_variable               (PsppireDataEditor *, gint dict_index);
86 void psppire_data_editor_data_delete_variables       (PsppireDataEditor *de);
87 void psppire_data_editor_var_delete_variables        (PsppireDataEditor *de);
88 void psppire_data_editor_insert_new_case_at_posn     (PsppireDataEditor *de, gint posn);
89 void psppire_data_editor_insert_new_variable_at_posn (PsppireDataEditor *de, gint posn);
90
91 struct _PsppireDataSheet *psppire_data_editor_get_active_data_sheet (PsppireDataEditor *);
92
93 enum {PSPPIRE_DATA_EDITOR_DATA_VIEW = 0, PSPPIRE_DATA_EDITOR_VARIABLE_VIEW};
94
95 void psppire_data_editor_paste (PsppireDataEditor *de);
96
97 G_END_DECLS
98
99 #endif /* __PSPPIRE_DATA_EDITOR_H__ */