1 /* PSPPIRE - a graphical user interface for PSPP. 2 Copyright (C) 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 This is a an abstract base class, which implements GAction. 19 It's purpose is to abstract the way in which dialog boxes behave. 20 That is, this action will fire whenever a dialog box is to be 21 popped up. 22 23 Additionally, most dialog boxes generate syntax to 24 be run by the pspp back-end. This provides an abstraction 25 to do that. The programmer needs only to provide the function 26 to generate the syntax. This base class looks after the rest. 27 */ 28 29 #ifndef __PSPPIRE_DIALOG_ACTION_H__ 30 #define __PSPPIRE_DIALOG_ACTION_H__ 31 32 #include <glib-object.h> 33 #include <glib.h> 34 35 #include "psppire-dict.h" 36 #include "psppire-dialog.h" 37 #include <gtk/gtk.h> 38 39 G_BEGIN_DECLS 40 41 42 #define PSPPIRE_TYPE_DIALOG_ACTION (psppire_dialog_action_get_type ()) 43 44 #define PSPPIRE_DIALOG_ACTION(obj) \ 45 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ 46 PSPPIRE_TYPE_DIALOG_ACTION, PsppireDialogAction)) 47 48 #define PSPPIRE_DIALOG_ACTION_CLASS(klass) \ 49 (G_TYPE_CHECK_CLASS_CAST ((klass), \ 50 PSPPIRE_TYPE_DIALOG_ACTION, \ 51 PsppireDialogActionClass)) 52 53 #define PSPPIRE_IS_DIALOG_ACTION(obj) \ 54 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION)) 55 56 #define PSPPIRE_IS_DIALOG_ACTION_CLASS(klass) \ 57 (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION)) 58 59 60 #define PSPPIRE_DIALOG_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ 61 PSPPIRE_TYPE_DIALOG_ACTION, \ 62 PsppireDialogActionClass)) 63 64 typedef struct _PsppireDialogAction PsppireDialogAction; 65 typedef struct _PsppireDialogActionClass PsppireDialogActionClass; 66 67 68 struct _PsppireDialogAction 69 { 70 GObject parent; 71 72 /*< private >*/ 73 GVariantType *parameter_type; 74 GtkWidget *source; 75 GtkWidget *dialog; 76 77 GtkWidget *toplevel; 78 PsppireDict *dict; 79 80 gboolean activated; 81 }; 82 83 struct _PsppireDialogActionClass 84 { 85 GObjectClass parent_class; 86 GtkBuilder * (*initial_activate) (PsppireDialogAction *, GVariant *); 87 void (*activate) (PsppireDialogAction *, GVariant *); 88 char * (*generate_syntax) (const PsppireDialogAction *); 89 }; 90 91 GType psppire_dialog_action_get_type (void) ; 92 93 typedef void (*PsppireDialogActionRefresh) (PsppireDialogAction *) ; 94 95 void psppire_dialog_action_set_refresh (PsppireDialogAction *pda, 96 PsppireDialogActionRefresh refresh); 97 98 void psppire_dialog_action_set_valid_predicate (PsppireDialogAction *act, 99 ContentsAreValid dialog_state_valid); 100 101 GtkBuilder * psppire_dialog_action_get_xml (PsppireDialogAction *da); 102 103 104 void psppire_dialog_action_activate_null (PsppireDialogAction *act); 105 106 G_END_DECLS 107 108 #endif /* __PSPPIRE_DIALOG_ACTION_H__ */ 109