1 /* 2 * Copyright (C) 2002 Derek Atkins 3 * 4 * Authors: Derek Atkins <warlord@MIT.EDU> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public 17 * License along with this program; if not, write to the 18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA. 20 */ 21 22 #ifndef _GNCSEARCH_CORE_TYPE_H 23 #define _GNCSEARCH_CORE_TYPE_H 24 25 #include "qof.h" 26 #include "search-param.h" 27 28 #define GNC_TYPE_SEARCH_CORE_TYPE (gnc_search_core_type_get_type ()) 29 #define GNC_SEARCH_CORE_TYPE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SEARCH_CORE_TYPE, GNCSearchCoreType)) 30 #define GNC_SEARCH_CORE_TYPE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_SEARCH_CORE_TYPE, GNCSearchCoreTypeClass)) 31 #define GNC_IS_SEARCH_CORE_TYPE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SEARCH_CORE_TYPE)) 32 #define GNC_SEARCH_CORE_TYPE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_SEARCH_CORE_TYPE, GNCSearchCoreTypeClass)) 33 34 typedef struct 35 { 36 GObject parent; 37 38 /* This appears to be unused */ 39 GNCSearchParam * param; 40 } GNCSearchCoreType; 41 42 typedef struct 43 { 44 GObjectClass parent_class; 45 46 /* virtual methods */ 47 void (*grab_focus) (GNCSearchCoreType *fe); 48 void (*editable_enters) (GNCSearchCoreType *fe); 49 void (*pass_parent) (GNCSearchCoreType *fe, gpointer parent); 50 gboolean (*validate) (GNCSearchCoreType *fe); 51 GNCSearchCoreType * (*clone) (GNCSearchCoreType *fe); 52 GtkWidget * (*get_widget) (GNCSearchCoreType *); 53 QofQueryPredData* (*get_predicate) (GNCSearchCoreType *); 54 55 /* signals */ 56 } GNCSearchCoreTypeClass; 57 58 /* These are internal functions */ 59 GType gnc_search_core_type_get_type (void); 60 GNCSearchCoreType * gnc_search_core_type_new (void); 61 62 /* Create a new search core_type */ 63 GNCSearchCoreType * gnc_search_core_type_new_type_name (const char *type); 64 65 /* methods */ 66 void gnc_search_core_type_grab_focus (GNCSearchCoreType *fe); 67 void gnc_search_core_type_editable_enters (GNCSearchCoreType *fe); 68 void gnc_search_core_type_pass_parent (GNCSearchCoreType *fe, gpointer parent); 69 gboolean gnc_search_core_type_validate (GNCSearchCoreType *fe); 70 GNCSearchCoreType * gnc_search_core_type_clone (GNCSearchCoreType *fe); 71 GtkWidget * gnc_search_core_type_get_widget (GNCSearchCoreType *fe); 72 QofQueryPredData* gnc_search_core_type_get_predicate (GNCSearchCoreType *fe); 73 74 /* Register a new type in the Core Type Database */ 75 typedef GNCSearchCoreType * (*GNCSearchCoreNew) (void); 76 void gnc_search_core_register_type (const char *type_name, 77 GNCSearchCoreNew fcn); 78 79 80 /* Initialize and Finalize the Core Type Database */ 81 void gnc_search_core_initialize (void); 82 void gnc_search_core_finalize (void); 83 84 85 #endif /* ! _GNCSEARCH_CORE_TYPE_H */ 86