1 /* 2 * business-gnome-utils.h -- General GUI Utilities for GNC Business Objects 3 * 4 * Written By: Derek Atkins <warlord@MIT.EDU> 5 * Copyright (C) 2001,2006 Derek Atkins 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License as 9 * published by the Free Software Foundation; either version 2 of 10 * the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, contact: 19 * 20 * Free Software Foundation Voice: +1-617-542-5942 21 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 22 * Boston, MA 02110-1301, USA gnu@gnu.org 23 */ 24 25 #ifndef GNC_BUSINESS_GNOME_UTILS_H_ 26 #define GNC_BUSINESS_GNOME_UTILS_H_ 27 28 #include "gncOwner.h" 29 #include "gncBillTerm.h" 30 #include "gncTaxTable.h" 31 #include "gncInvoice.h" 32 33 34 #define GNC_PREFS_GROUP_INVOICE "dialogs.business.invoice" 35 #define GNC_PREFS_GROUP_BILL "dialogs.business.bill" 36 #define GNC_PREFS_GROUP_VOUCHER "dialogs.business.voucher" 37 38 #define GNC_PREF_AUTO_PAY "auto-pay" 39 40 41 GtkWidget * gnc_owner_select_create (GtkWidget *label, GtkWidget *hbox, 42 QofBook *book, GncOwner *owner); 43 44 GtkWidget * gnc_owner_edit_create (GtkWidget *label, GtkWidget *hbox, 45 QofBook *book, GncOwner *owner); 46 47 void gnc_owner_get_owner (GtkWidget *widget, GncOwner *owner); 48 void gnc_owner_set_owner (GtkWidget *widget, GncOwner *owner); 49 50 51 /* An invoice select widget.. 52 * the owner, invoice, and label parameters are optional 53 */ 54 GtkWidget * gnc_invoice_select_create (GtkWidget *hbox, QofBook *book, 55 const GncOwner *owner, 56 GncInvoice *invoice, 57 GtkWidget *label); 58 59 GncInvoice * gnc_invoice_get_invoice (GtkWidget *widget); 60 void gnc_invoice_set_invoice (GtkWidget *widget, GncInvoice *invoice); 61 void gnc_invoice_set_owner (GtkWidget *widget, GncOwner *owner); 62 63 /* Fill in a combo box with the appropriate list of accounts 64 * Returns the default selected account */ 65 Account * gnc_account_select_combo_fill (GtkWidget *combo, QofBook *book, 66 GList *acct_types, 67 GList *acct_commodities); 68 69 /* Returns the currently selected account in the combo box*/ 70 Account * gnc_account_select_combo_get_active (GtkWidget *combo); 71 72 /* Create a combo box of available billing terms based on 73 * the combo box If none_ok is true, then add "none" as a 74 * choice (with data set to NULL). If initial_choice is non-NULL, 75 * then that will be the default option setting when the menu is 76 * created. 77 * 78 * Note: if you are interested in the currently active combo box 79 * item, you can use the function gnc_simple_combo_get_value below. 80 * This can be used for example in a callback function that triggers 81 * on the combo box' "changed" signal" 82 */ 83 void gnc_billterms_combo (GtkComboBox *cbox, QofBook *book, 84 gboolean none_ok, GncBillTerm *initial_choice); 85 86 /* Same thing except for the tax tables */ 87 void 88 gnc_taxtables_combo (GtkComboBox *cbox, QofBook *book, 89 gboolean none_ok, GncTaxTable *initial_choice); 90 91 /* Build an option menu for choosing a GncTaxIncluded */ 92 void gnc_taxincluded_combo (GtkComboBox *cbox, GncTaxIncluded initial_choice); 93 94 95 /* Here are some "simple combo box" utilities that can be used with 96 * ANY of the above combo box types. In particular the following 97 * functions are useful for hooking the above combo boxes into the 98 * GNC Option infrastructure. 99 */ 100 101 /** Get the value of the item that is currently selected in the combo box */ 102 gpointer gnc_simple_combo_get_value (GtkComboBox *cbox); 103 104 /** Find the item in the combo box whose value is "data" 105 * and make it the active item. */ 106 void gnc_simple_combo_set_value (GtkComboBox *cbox, gpointer data); 107 108 109 #endif /* GNC_BUSINESS_GNOME_UTILS_H_ */ 110