GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gnc-amount-edit.h
1 /*
2  * gnc-amount-edit.h -- amount editor widget
3  *
4  * Copyright (C) 2000 Dave Peticolas <[email protected]>
5  * All rights reserved.
6  *
7  * GnuCash is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Library General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * Gnucash 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 GNU
15  * Library 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 [email protected]
23  *
24  */
25 /*
26  @NOTATION@
27  */
28 
29 #ifndef GNC_AMOUNT_EDIT_H
30 #define GNC_AMOUNT_EDIT_H
31 
32 #include "qof.h"
33 #include "gnc-ui-util.h"
34 
35 #define GNC_TYPE_AMOUNT_EDIT (gnc_amount_edit_get_type())
36 #define GNC_AMOUNT_EDIT(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_AMOUNT_EDIT, GNCAmountEdit)
37 #define GNC_AMOUNT_EDIT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, GNC_TYPE_AMOUNT_EDIT, GNCAmountEditClass)
38 #define GNC_IS_AMOUNT_EDIT(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GNC_TYPE_AMOUNT_EDIT)
39 
40 typedef struct
41 {
42  GtkEntry entry;
43 
44  gboolean need_to_parse;
45 
46  GNCPrintAmountInfo print_info;
47 
48  gnc_numeric amount;
49 
50  int fraction;
51 
52  gboolean evaluate_on_enter;
53 
55 
56 typedef struct
57 {
58  GtkEntryClass parent_class;
59 
60  /* Signals for notification/filtering of changes */
61  void (*amount_changed) (GNCAmountEdit *gae);
63 
64 GType gnc_amount_edit_get_type (void);
65 
66 GtkWidget *gnc_amount_edit_new (void);
67 
68 GtkWidget *gnc_amount_edit_gtk_entry (GNCAmountEdit *gae);
69 
70 void gnc_amount_edit_set_amount (GNCAmountEdit *gae,
71  gnc_numeric amount);
72 void gnc_amount_edit_set_damount (GNCAmountEdit *gae,
73  double amount);
74 
75 gnc_numeric gnc_amount_edit_get_amount (GNCAmountEdit *gae);
76 double gnc_amount_edit_get_damount (GNCAmountEdit *gae);
77 
78 gint gnc_amount_edit_expr_is_valid (GNCAmountEdit *gae, gnc_numeric *amount,
79  gboolean empty_ok);
80 gboolean gnc_amount_edit_evaluate (GNCAmountEdit *gae);
81 
82 void gnc_amount_edit_set_print_info (GNCAmountEdit *gae,
83  GNCPrintAmountInfo print_info);
84 
85 void gnc_amount_edit_set_fraction (GNCAmountEdit *gae, int fraction);
86 
87 void gnc_amount_edit_set_evaluate_on_enter (GNCAmountEdit *gae,
88  gboolean evaluate_on_enter);
89 #endif
utility functions for the GnuCash UI