af56aac1e8a8fcff9de48d088329f8ac96c9c17a
[pspp] / src / ui / gui / psppire-dialog.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2007, 2010, 2011, 2012  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_DIALOG_H__
19 #define __PSPPIRE_DIALOG_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
28 #define PSPPIRE_RESPONSE_PASTE 1
29 #define PSPPIRE_RESPONSE_GOTO 2
30 #define PSPPIRE_RESPONSE_CONTINUE 3
31
32 G_BEGIN_DECLS
33
34 #define PSPPIRE_TYPE_DIALOG            (psppire_dialog_get_type ())
35 #define PSPPIRE_DIALOG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_TYPE_DIALOG, PsppireDialog))
36 #define PSPPIRE_DIALOG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PSPPIRE_TYPE_DIALOG, PsppireDialogClass))
37 #define PSPPIRE_IS_DIALOG(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG))
38 #define PSPPIRE_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG))
39
40
41 typedef struct _PsppireDialog       PsppireDialog;
42 typedef struct _PsppireDialogClass  PsppireDialogClass;
43
44 typedef gboolean (*ContentsAreValid) (gpointer);
45
46 typedef enum
47   {
48     PSPPIRE_HORIZONTAL,
49     PSPPIRE_VERTICAL,
50     PSPPIRE_TABULAR
51   } PsppireOrientation;
52
53
54
55 struct _PsppireDialog
56 {
57   PsppireWindowBase window;
58   GtkWidget *box;
59
60   /* Private */
61   GMainLoop *loop;
62   gint response;
63
64   ContentsAreValid contents_are_valid;
65   gpointer validity_data;
66   ContentsAreValid contents_are_acceptable;
67   gpointer acceptable_data;
68   gboolean slidable;
69   PsppireOrientation orientation;
70 };
71
72 struct _PsppireDialogClass
73 {
74   PsppireWindowBaseClass parent_class;
75 };
76
77
78 GType          psppire_dialog_get_type        (void);
79 GtkWidget*     psppire_dialog_new             (void);
80 void           psppire_dialog_reload          (PsppireDialog *);
81 void           psppire_dialog_help            (PsppireDialog *);
82 void           psppire_dialog_close           (PsppireDialog *);
83 gint           psppire_dialog_run             (PsppireDialog *);
84 void           psppire_dialog_set_valid_predicate (PsppireDialog *,
85                                                    ContentsAreValid,
86                                                    gpointer );
87 void           psppire_dialog_set_accept_predicate (PsppireDialog *,
88                                                     ContentsAreValid,
89                                                     gpointer );
90 gboolean       psppire_dialog_is_acceptable (const PsppireDialog *);
91 void           psppire_dialog_notify_change (PsppireDialog *);
92
93
94
95 GType psppire_orientation_get_type (void);
96
97
98 #define PSPPIRE_TYPE_ORIENTATION (psppire_orientation_get_type ())
99
100
101 G_END_DECLS
102
103 #endif /* __PSPPIRE_DIALOG_H__ */
104