Branch data Line data Source code
1 : : /* 2 : : * gnc-currency-edit.h -- Currency editor widget 3 : : * 4 : : * Copyright (C) 2000 Free Software Foundation 5 : : * All rights reserved. 6 : : * 7 : : * Dave Peticolas <dave@krondo.com> 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 : : /** @addtogroup GUI 29 : : @{ */ 30 : : /** @addtogroup GncCurrencyEdit 31 : : * @{ */ 32 : : /** @file gnc-currency-edit.h 33 : : * @brief Currency selection widget. 34 : : * @author Dave Peticolas <dave@krondo.com> 35 : : * @author David Hampton <hampton@employees.org> 36 : : * 37 : : * This widget is a GtkComboBox that is wrapped with support 38 : : * functions for building/selecting from a list of ISO4217 currency 39 : : * names. All data is maintained within the widget itself, which 40 : : * makes the name/item lookup functions somewhat complicated. The 41 : : * alternative coding would be to keep an auxiliary list of strings 42 : : * attacked to the widget for lookup purposes, but that would be 100% 43 : : * redundant information. 44 : : * 45 : : * When the GtkComboCellEntry widget supports completion, this Gnucash 46 : : * widget should be modified so that it is based upon that widget. 47 : : * That would give users the capability to select a currency by typing 48 : : * its ISO 4217 code (e.g. USD, GBP, etc). Moving to that widget 49 : : * today, however, would cause more problems that its worth. There is 50 : : * currently no way to get access to the embedded GtkEntry widget, and 51 : : * therefore no way to implement completion in gnucash or prevent the 52 : : * user from typing in random data. 53 : : */ 54 : : 55 : : #ifndef GNC_CURRENCY_EDIT_H 56 : : #define GNC_CURRENCY_EDIT_H 57 : : 58 : : #include "gnc-commodity.h" 59 : : 60 : : #ifdef __cplusplus 61 : : extern "C" { 62 : : #endif 63 : : 64 : : /** @name Basic Object Implementation */ 65 : : /** @{ */ 66 : : 67 : : #define GNC_TYPE_CURRENCY_EDIT (gnc_currency_edit_get_type()) 68 : 0 : G_DECLARE_FINAL_TYPE (GNCCurrencyEdit, gnc_currency_edit, GNC, CURRENCY_EDIT, GtkComboBox) 69 : : 70 : : /** Create a new GNCCurrencyEdit widget which can be used to provide 71 : : * an easy way to enter ISO currency codes. 72 : : * 73 : : * @return A GNCCurrencyEdit widget. 74 : : */ 75 : : GtkWidget *gnc_currency_edit_new (void); 76 : : /** @} */ 77 : : 78 : : 79 : : /** @name Get/Set Functions */ 80 : : /** @{ */ 81 : : 82 : : /** Set the widget to display a certain currency name. 83 : : * 84 : : * @param gce The currency editor widget to set. 85 : : * 86 : : * @param currency The currency to set as the displayed/selected 87 : : * value of the widget. 88 : : */ 89 : : void gnc_currency_edit_set_currency (GNCCurrencyEdit *gce, 90 : : const gnc_commodity *currency); 91 : : 92 : : 93 : : /** Retrieve the displayed currency of the widget. 94 : : * 95 : : * @param gce The currency editor widget whose values should be retrieved. 96 : : * 97 : : * @return A pointer to the selected currency (a gnc_commodity 98 : : * structure). 99 : : */ 100 : : gnc_commodity *gnc_currency_edit_get_currency (GNCCurrencyEdit *gce); 101 : : 102 : : 103 : : /** Clear the displayed currency of the widget. 104 : : * 105 : : * This will clear the currency being displayed just like when first created 106 : : * but it still returns the default currency as usual 107 : : * 108 : : * @param gce The currency editor widget whose values should be retrieved. 109 : : */ 110 : : void gnc_currency_edit_clear_display (GNCCurrencyEdit *gce); 111 : : 112 : : /** @} */ 113 : : 114 : : #ifdef __cplusplus 115 : : } 116 : : #endif 117 : : 118 : : #endif 119 : : 120 : : /** @} */ 121 : : /** @} */ 122 : :