X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-window.h;h=bc1b0f0b280770b87ae1414b7da4dc10b63c2e97;hb=4f66e6c17635237ca970fa383a77a763b02f16b2;hp=ca5136a7bafc32cd28696ab0c0efdc52479a5858;hpb=c9e28aa922c35b8764925fe824794886b8f17a86;p=pspp diff --git a/src/ui/gui/psppire-window.h b/src/ui/gui/psppire-window.h index ca5136a7ba..bc1b0f0b28 100644 --- a/src/ui/gui/psppire-window.h +++ b/src/ui/gui/psppire-window.h @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2008 Free Software Foundation + Copyright (C) 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,60 +21,82 @@ #include #include -#include -#include +#include +#include "psppire-window-base.h" G_BEGIN_DECLS -typedef enum { - PSPPIRE_WINDOW_USAGE_SYNTAX, - PSPPIRE_WINDOW_USAGE_OUTPUT, - PSPPIRE_WINDOW_USAGE_DATA -} PsppireWindowUsage; +#define PSPPIRE_TYPE_WINDOW (psppire_window_get_type ()) -GType psppire_window_usage_get_type (void); +#define PSPPIRE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + PSPPIRE_TYPE_WINDOW, PsppireWindow)) +#define PSPPIRE_WINDOW_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + PSPPIRE_TYPE_WINDOW, PsppireWindowClass)) -#define G_TYPE_PSPPIRE_WINDOW_USAGE \ - (psppire_window_usage_get_type()) +#define PSPPIRE_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + PSPPIRE_TYPE_WINDOW)) - +#define PSPPIRE_IS_WINDOW_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + PSPPIRE_TYPE_WINDOW)) -#define PSPPIRE_WINDOW_TYPE (psppire_window_get_type ()) -#define PSPPIRE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_WINDOW_TYPE, PsppireWindow)) -#define PSPPIRE_WINDOW_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ - PSPPIRE_WINDOW_TYPE, PsppireWindowClass)) -#define PSPPIRE_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - PSPPIRE_WINDOW_TYPE)) -#define PSPPIRE_IS_WINDOW_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ - PSPPIRE_WINDOW_TYPE)) + +#define PSPPIRE_TYPE_WINDOW_MODEL (psppire_window_model_get_type ()) + +#define PSPPIRE_IS_WINDOW_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_WINDOW_MODEL)) + +#define PSPPIRE_WINDOW_MODEL_GET_IFACE(obj) \ + (G_TYPE_INSTANCE_GET_INTERFACE ((obj), PSPPIRE_TYPE_WINDOW_MODEL, PsppireWindowIface)) typedef struct _PsppireWindow PsppireWindow; typedef struct _PsppireWindowClass PsppireWindowClass; +typedef struct _PsppireWindowIface PsppireWindowIface; struct _PsppireWindow { - GtkWindow parent; + PsppireWindowBase parent; /* */ - gchar *name; - gboolean finalized; - PsppireWindowUsage usage; + gchar *filename; /* File name, in file name encoding, or NULL. */ + gchar *basename; /* Last component of filename, in UTF-8 */ + gchar *id; /* Dataset name, or NULL. */ + gchar *description; /* e.g. "Data Editor" */ + gchar *list_name; /* Name for "Windows" menu list. */ + + GHashTable *menuitem_table; + + guint insert_handler; + guint remove_handler; + + gboolean added_separator; + gboolean dirty; + GTimeVal savetime; }; + struct _PsppireWindowClass { - GtkWindowClass parent_class; + PsppireWindowBaseClass parent_class; +}; + + +struct _PsppireWindowIface +{ + GTypeInterface g_iface; - GHashTable *name_table; + void (*save) (PsppireWindow *w); + void (*pick_filename) (PsppireWindow *); + gboolean (*load) (PsppireWindow *w, const gchar *filename, + const gchar *encoding, gpointer hint); }; + GType psppire_window_get_type (void); -GtkWidget* psppire_window_new (PsppireWindowUsage usage); +GType psppire_window_model_get_type (void); const gchar * psppire_window_get_filename (PsppireWindow *); @@ -82,6 +104,21 @@ void psppire_window_set_filename (PsppireWindow *w, const gchar *filename); void psppire_window_minimise_all (void); +void psppire_window_set_unsaved (PsppireWindow *); + +gboolean psppire_window_get_unsaved (PsppireWindow *); + +gint psppire_window_query_save (PsppireWindow *); + +void psppire_window_save (PsppireWindow *w); +void psppire_window_save_as (PsppireWindow *w); +gboolean psppire_window_load (PsppireWindow *w, const gchar *file, + const gchar *encoding, gpointer hint); +void psppire_window_open (PsppireWindow *de); +GtkWidget *psppire_window_file_chooser_dialog (PsppireWindow *toplevel); + +void add_most_recent (const char *file_name, const char *mime_type, + const char *encoding); G_END_DECLS