1 /********************************************************************\
2  * reconcile-view.h -- GNOME reconcile view functions               *
3  * Copyright (C) 1998,1999 Linas Vepstas                            *
4  * Copyright (C) 2003 Derek Atkins <derek@ihtfp.com>                *
5  * Copyright (C) 2012 Robert Fewell                                 *
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_RECONCILE_VIEW_H
26 #define GNC_RECONCILE_VIEW_H
27 
28 #include "gnc-query-view.h"
29 #include "qof.h"
30 
31 G_BEGIN_DECLS
32 
33 #define GNC_TYPE_RECONCILE_VIEW		(gnc_reconcile_view_get_type ())
34 #define GNC_RECONCILE_VIEW(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_RECONCILE_VIEW, GNCReconcileView))
35 #define GNC_RECONCILE_VIEW_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_RECONCILE_VIEW, GNCReconcileViewClass))
36 #define GNC_IS_RECONCILE_VIEW(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_RECONCILE_VIEW))
37 #define GNC_IS_RECONCILE_VIEW_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_RECONCILE_VIEW))
38 
39 typedef struct GNCReconcileView GNCReconcileView;
40 
41 typedef enum
42 {
43     RECLIST_DEBIT,
44     RECLIST_CREDIT
45 } GNCReconcileViewType;
46 
47 enum
48 {
49     REC_POINTER, //0
50     REC_DATE,    //1
51     REC_NUM,     //2
52     REC_DESC,    //3
53     REC_AMOUNT,  //4
54     REC_RECN,    //5
55 };
56 
57 struct GNCReconcileView
58 {
59     GNCQueryView         qview;
60 
61     GHashTable          *reconciled;
62     Account             *account;
63     GList               *column_list;
64 
65     time64               statement_date;
66 
67     GNCReconcileView    *sibling;
68     GNCReconcileViewType view_type;
69     gboolean             no_toggle;
70 };
71 
72 typedef struct
73 {
74     GtkTreeViewClass parent_class;
75 
76     void (*toggle_reconciled)  (GNCReconcileView *view, Split *split);
77     void (*line_selected)      (GNCReconcileView *view, gpointer item);
78     void (*double_click_split) (GNCReconcileView *view, Split *split);
79 } GNCReconcileViewClass;
80 
81 #define GNC_PREFS_GROUP_RECONCILE "dialogs.reconcile"
82 
83 /***********************************************************
84  *                public functions                         *
85  ***********************************************************/
86 
87 GType gnc_reconcile_view_get_type (void);
88 
89 GtkWidget * gnc_reconcile_view_new (Account * account,
90                                     GNCReconcileViewType type,
91                                     time64 date);
92 
93 gint gnc_reconcile_view_get_num_splits (GNCReconcileView *view);
94 
95 gint gnc_reconcile_view_num_selected (GNCReconcileView *view );
96 
97 Split * gnc_reconcile_view_get_current_split (GNCReconcileView *view);
98 
99 void gnc_reconcile_view_set_list (GNCReconcileView *view, gboolean reconcile);
100 
101 void gnc_reconcile_view_refresh (GNCReconcileView *view);
102 
103 gnc_numeric gnc_reconcile_view_reconciled_balance (GNCReconcileView *view);
104 
105 void gnc_reconcile_view_commit (GNCReconcileView *view, time64 date);
106 
107 void gnc_reconcile_view_postpone (GNCReconcileView *view);
108 
109 void gnc_reconcile_view_unselect_all (GNCReconcileView *view);
110 
111 gboolean gnc_reconcile_view_changed (GNCReconcileView *view);
112 
113 void gnc_reconcile_view_add_padding (GNCReconcileView *view, gint column, gint xpadding);
114 
115 gint gnc_reconcile_view_get_column_width (GNCReconcileView *view, gint column);
116 
117 G_END_DECLS
118 
119 #endif /* GNC_RECONCILE_VIEW_H */
120