|
GnuCash 2.4.99
|
00001 /********************************************************************\ 00002 * pricecell.h -- price input/display cell * 00003 * * 00004 * This program is free software; you can redistribute it and/or * 00005 * modify it under the terms of the GNU General Public License as * 00006 * published by the Free Software Foundation; either version 2 of * 00007 * the License, or (at your option) any later version. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU General Public License* 00015 * along with this program; if not, contact: * 00016 * * 00017 * Free Software Foundation Voice: +1-617-542-5942 * 00018 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 00019 * Boston, MA 02110-1301, USA gnu@gnu.org * 00020 * * 00021 \********************************************************************/ 00022 00023 /* 00024 * FILE: 00025 * pricecell.h 00026 * 00027 * FUNCTION: 00028 * The PriceCell object implements a cell handler that stores 00029 * a single double-precision value, and has the smarts to 00030 * display it as a price/amount as well as accepting monetary 00031 * or general numeric input. 00032 * 00033 * By default, the PriceCell is an input/output cell. 00034 * 00035 * On output, it will display negative values in red text. 00036 * hack alert -- the actual color (red) should be user configurable. 00037 * 00038 * HISTORY: 00039 * Copyright (c) 1998, 1999, 2000 Linas Vepstas 00040 * Copyright (c) 2000 Dave Peticolas <dave@krondo.com> 00041 * Copyright (c) 2001 Free Software Foundation 00042 */ 00043 00044 #ifndef PRICE_CELL_H 00045 #define PRICE_CELL_H 00046 00047 #include "basiccell.h" 00048 #include "qof.h" 00049 #include "gnc-ui-util.h" 00050 00051 typedef struct 00052 { 00053 BasicCell cell; 00054 00055 gnc_numeric amount; /* the amount associated with this cell */ 00056 00057 int fraction; /* fraction used for rounding, if 0 no rounding */ 00058 00059 gboolean blank_zero; /* controls printing of zero values */ 00060 00061 GNCPrintAmountInfo print_info; /* amount printing context */ 00062 00063 gboolean need_to_parse; /* internal */ 00064 } PriceCell; 00065 00066 /* installs a callback to handle price recording */ 00067 BasicCell * gnc_price_cell_new (void); 00068 00069 /* return the value of a price cell */ 00070 gnc_numeric gnc_price_cell_get_value (PriceCell *cell); 00071 00072 /* updates amount, returns TRUE if string representation 00073 * actually changed */ 00074 gboolean gnc_price_cell_set_value (PriceCell *cell, gnc_numeric amount); 00075 00076 /* Sets the fraction used for rounding. If 0, no rounding is performed. */ 00077 void gnc_price_cell_set_fraction (PriceCell *cell, int fraction); 00078 00079 /* Sets the cell as blank, regardless of the blank_zero value */ 00080 void gnc_price_cell_blank (PriceCell *cell); 00081 00082 /* determines whether 0 values are left blank or printed. 00083 * defaults to true. */ 00084 void gnc_price_cell_set_blank_zero (PriceCell *cell, 00085 gboolean blank_zero); 00086 00087 /* set the printing context of the price cell */ 00088 void gnc_price_cell_set_print_info (PriceCell *cell, 00089 GNCPrintAmountInfo print_info); 00090 00091 /* updates two cells; the deb cell if amt is negative, the credit cell 00092 * if amount is positive, and makes the other cell blank. */ 00093 void gnc_price_cell_set_debt_credit_value (PriceCell *debit, 00094 PriceCell *credit, 00095 gnc_numeric amount); 00096 00097 #endif
1.7.4