GnuCash  5.6-150-g038405b370+
pricecell.h
Go to the documentation of this file.
1 /********************************************************************\
2  * pricecell.h -- price input/display cell *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation; either version 2 of *
7  * the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License*
15  * along with this program; if not, contact: *
16  * *
17  * Free Software Foundation Voice: +1-617-542-5942 *
18  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19  * Boston, MA 02110-1301, USA gnu@gnu.org *
20  * *
21 \********************************************************************/
22 
37  /* HISTORY:
38  * Copyright (c) 1998, 1999, 2000 Linas Vepstas
39  * Copyright (c) 2000 Dave Peticolas <dave@krondo.com>
40  * Copyright (c) 2001 Free Software Foundation
41  */
42 
43 #ifndef PRICE_CELL_H
44 #define PRICE_CELL_H
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 #include "basiccell.h"
51 #include "qof.h"
52 #include "gnc-ui-util.h"
53 
54 typedef struct
55 {
56  BasicCell cell;
57  gnc_numeric amount;
58  int fraction;
59  gboolean blank_zero;
61  gboolean need_to_parse;
62 } PriceCell;
63 
65 BasicCell * gnc_price_cell_new (void);
66 
68 gnc_numeric gnc_price_cell_get_value (PriceCell *cell);
69 
72 gboolean gnc_price_cell_set_value (PriceCell *cell, gnc_numeric amount);
73 
75 void gnc_price_cell_set_fraction (PriceCell *cell, int fraction);
76 
78 void gnc_price_cell_blank (PriceCell *cell);
79 
83  gboolean blank_zero);
84 
87  GNCPrintAmountInfo print_info);
88 
92  PriceCell *credit,
93  gnc_numeric amount);
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
100 #endif
gboolean blank_zero
fraction used for rounding, if 0 no rounding
Definition: pricecell.h:59
int fraction
the amount associated with this cell
Definition: pricecell.h:58
utility functions for the GnuCash UI
void gnc_price_cell_blank(PriceCell *cell)
Sets the cell as blank, regardless of the blank_zero value.
Definition: pricecell.c:251
The PriceCell object implements a cell handler that stores a single double-precision value...
Definition: pricecell.h:54
GNCPrintAmountInfo print_info
controls printing of zero values
Definition: pricecell.h:60
void gnc_price_cell_set_fraction(PriceCell *cell, int fraction)
Sets the fraction used for rounding.
Definition: pricecell.c:242
void gnc_price_cell_set_print_info(PriceCell *cell, GNCPrintAmountInfo print_info)
set the printing context of the price cell
Definition: pricecell.c:272
gboolean need_to_parse
amount printing context
Definition: pricecell.h:61
void gnc_price_cell_set_blank_zero(PriceCell *cell, gboolean blank_zero)
determines whether 0 values are left blank or printed.
Definition: pricecell.c:263
gboolean gnc_price_cell_set_value(PriceCell *cell, gnc_numeric amount)
updates amount, returns TRUE if string representation actually changed
Definition: pricecell.c:219
BasicCell * gnc_price_cell_new(void)
installs a callback to handle price recording
Definition: pricecell.c:168
void gnc_price_cell_set_debt_credit_value(PriceCell *debit, PriceCell *credit, gnc_numeric amount)
updates two cells; the deb cell if amt is negative, the credit cell if amount is positive, and makes the other cell blank.
Definition: pricecell.c:281
gnc_numeric gnc_price_cell_get_value(PriceCell *cell)
return the value of a price cell
Definition: pricecell.c:208