0e57b4d78de57965160e67a9802a758649983691
[pspp] / src / ui / gui / psppire-window.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2008, 2009, 2010, 2011, 2013, 2014  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 #ifndef __PSPPIRE_WINDOW_H__
19 #define __PSPPIRE_WINDOW_H__
20
21
22 #include <glib.h>
23 #include <glib-object.h>
24 #include <gtk/gtk.h>
25 #include "psppire-window-base.h"
26
27 G_BEGIN_DECLS
28
29
30 #define PSPPIRE_TYPE_WINDOW            (psppire_window_get_type ())
31
32 #define PSPPIRE_WINDOW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
33     PSPPIRE_TYPE_WINDOW, PsppireWindow))
34
35 #define PSPPIRE_WINDOW_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), \
36     PSPPIRE_TYPE_WINDOW, PsppireWindowClass))
37
38 #define PSPPIRE_IS_WINDOW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
39     PSPPIRE_TYPE_WINDOW))
40
41 #define PSPPIRE_IS_WINDOW_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
42     PSPPIRE_TYPE_WINDOW))
43
44
45
46 #define PSPPIRE_TYPE_WINDOW_MODEL            (psppire_window_model_get_type ())
47
48 #define PSPPIRE_IS_WINDOW_MODEL(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_WINDOW_MODEL))
49
50 #define PSPPIRE_WINDOW_MODEL_GET_IFACE(obj) \
51    (G_TYPE_INSTANCE_GET_INTERFACE ((obj), PSPPIRE_TYPE_WINDOW_MODEL, PsppireWindowIface))
52
53
54 typedef struct _PsppireWindow       PsppireWindow;
55 typedef struct _PsppireWindowClass  PsppireWindowClass;
56 typedef struct _PsppireWindowIface  PsppireWindowIface;
57
58
59 struct _PsppireWindow
60 {
61   PsppireWindowBase parent;
62
63   /* <private> */
64   gchar *filename;             /* File name, in file name encoding, or NULL. */
65   gchar *basename;             /* Last component of filename, in UTF-8 */
66   gchar *id;                   /* Dataset name, or NULL.  */
67   gchar *description;          /* e.g. "Data Editor" */
68   gchar *list_name;            /* Name for "Windows" menu list. */
69
70   GHashTable *menuitem_table;
71   GtkMenuShell *menu;
72
73   guint insert_handler;
74   guint remove_handler;
75
76   gboolean added_separator;
77   gboolean dirty;
78   GTimeVal savetime;
79 };
80
81
82 struct _PsppireWindowClass
83 {
84   PsppireWindowBaseClass parent_class;
85 };
86
87
88 struct _PsppireWindowIface
89 {
90   GTypeInterface g_iface;
91
92   void (*save) (PsppireWindow *w);
93   void (*pick_filename) (PsppireWindow *);
94   gboolean (*load) (PsppireWindow *w, const gchar *filename,
95                     const gchar *encoding, gpointer hint);
96 };
97
98
99 GType      psppire_window_get_type        (void);
100 GType      psppire_window_model_get_type        (void);
101
102 const gchar * psppire_window_get_filename (PsppireWindow *);
103
104 void psppire_window_set_filename (PsppireWindow *w, const gchar *filename);
105
106 void psppire_window_minimise_all (void);
107
108 void psppire_window_set_unsaved (PsppireWindow *);
109
110 gboolean psppire_window_get_unsaved (PsppireWindow *);
111
112 gint psppire_window_query_save (PsppireWindow *);
113
114 void psppire_window_save (PsppireWindow *w);
115 void psppire_window_save_as (PsppireWindow *w);
116 gboolean psppire_window_load (PsppireWindow *w, const gchar *file,
117                               const gchar *encoding, gpointer hint);
118 void psppire_window_open (PsppireWindow *de);
119 GtkWidget *psppire_window_file_chooser_dialog (PsppireWindow *toplevel);
120
121 void add_most_recent (const char *file_name, const char *mime_type,
122                       const char *encoding);
123
124 G_END_DECLS
125
126 #endif /* __PSPPIRE_WINDOW_H__ */