1 /* 2 * gnc-general-select.h -- General Selection Widget 3 * 4 * Copyright (C) 2001 Free Software Foundation 5 * All rights reserved. 6 * 7 * Derek Atkins <warlord@MIT.EDU> 8 * 9 * GnuCash is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU Library General Public License as 11 * published by the Free Software Foundation; either version 2 of 12 * the License, or (at your option) any later version. 13 * 14 * Gnucash is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Library General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, contact: 21 * 22 * Free Software Foundation Voice: +1-617-542-5942 23 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 24 * Boston, MA 02110-1301, USA gnu@gnu.org 25 * 26 */ 27 /* 28 @NOTATION@ 29 */ 30 31 #ifndef GNC_GENERAL_SELECT_H 32 #define GNC_GENERAL_SELECT_H 33 34 #define GNC_TYPE_GENERAL_SELECT (gnc_general_select_get_type ()) 35 #define GNC_GENERAL_SELECT(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gnc_general_select_get_type(), GNCGeneralSelect) 36 #define GNC_GENERAL_SELECT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gnc_general_select_get_type(), \ GNCGeneralSelectClass) 37 #define GNC_IS_GENERAL_SELECT(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gnc_general_select_get_type ()) 38 39 typedef const char * (*GNCGeneralSelectGetStringCB) (gpointer); 40 typedef gpointer (*GNCGeneralSelectNewSelectCB) (gpointer cbarg, gpointer default_selection, GtkWidget *parent); 41 42 typedef enum 43 { 44 GNC_GENERAL_SELECT_TYPE_SELECT = 1, 45 GNC_GENERAL_SELECT_TYPE_EDIT = 2, 46 GNC_GENERAL_SELECT_TYPE_VIEW = 3 47 } GNCGeneralSelectType; 48 49 typedef struct 50 { 51 GtkBox hbox; 52 53 GtkWidget *entry; /* display of selection name */ 54 GtkWidget *button; /* button for popping up selection window */ 55 56 gpointer selected_item; 57 58 GNCGeneralSelectGetStringCB get_string; 59 GNCGeneralSelectNewSelectCB new_select; 60 gpointer cb_arg; 61 62 int disposed; /* private */ 63 } GNCGeneralSelect; 64 65 typedef struct 66 { 67 GtkBoxClass parent_class; 68 69 void (*changed) (GNCGeneralSelect *edit); 70 } GNCGeneralSelectClass; 71 72 73 GtkWidget *gnc_general_select_new (GNCGeneralSelectType type, 74 GNCGeneralSelectGetStringCB get_string, 75 GNCGeneralSelectNewSelectCB new_select, 76 gpointer cb_arg); 77 void gnc_general_select_set_selected (GNCGeneralSelect *gsl, 78 gpointer selected); 79 gpointer gnc_general_select_get_selected (GNCGeneralSelect *gsl); 80 const char *gnc_general_select_get_printname (GNCGeneralSelect *gsl, 81 gpointer selection); 82 GType gnc_general_select_get_type (void); 83 84 void gnc_general_select_make_mnemonic_target (GNCGeneralSelect *gsl, GtkWidget *label); 85 86 #endif 87 88