GnuCash  5.6-150-g038405b370+
gnc-tree-model-account.h
Go to the documentation of this file.
1 /*
2  * gnc-tree-model-account.h -- GtkTreeModel implementation to
3  * display accounts in a GtkTreeView.
4  *
5  * Copyright (C) 2003 Jan Arne Petersen <jpetersen@uni-bonn.de>
6  * Copyright (C) 2003 David Hampton <hampton@employees.org>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, contact:
20  *
21  * Free Software Foundation Voice: +1-617-542-5942
22  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
23  * Boston, MA 02110-1301, USA gnu@gnu.org
24  */
25 
36 #ifndef __GNC_TREE_MODEL_ACCOUNT_H
37 #define __GNC_TREE_MODEL_ACCOUNT_H
38 
39 #include <gtk/gtk.h>
40 #include "gnc-tree-model.h"
41 
42 #include "Account.h"
43 
44 G_BEGIN_DECLS
45 
46 /* type macros */
47 #define GNC_TYPE_TREE_MODEL_ACCOUNT (gnc_tree_model_account_get_type ())
48 G_DECLARE_FINAL_TYPE (GncTreeModelAccount, gnc_tree_model_account, GNC, TREE_MODEL_ACCOUNT, GncTreeModel)
49 #define GNC_TREE_MODEL_ACCOUNT_NAME "GncTreeModelAccount"
50 
51 typedef enum
52 {
53  GNC_TREE_MODEL_ACCOUNT_COL_NAME,
54  GNC_TREE_MODEL_ACCOUNT_COL_TYPE,
55  GNC_TREE_MODEL_ACCOUNT_COL_COMMODITY,
56  GNC_TREE_MODEL_ACCOUNT_COL_CODE,
57  GNC_TREE_MODEL_ACCOUNT_COL_DESCRIPTION,
58  GNC_TREE_MODEL_ACCOUNT_COL_LASTNUM,
59  GNC_TREE_MODEL_ACCOUNT_COL_PRESENT,
60  GNC_TREE_MODEL_ACCOUNT_COL_PRESENT_REPORT,
61  GNC_TREE_MODEL_ACCOUNT_COL_BALANCE,
62  GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_REPORT,
63  GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_PERIOD,
64  GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_LIMIT,
65  GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_LIMIT_EXPLANATION,
66  GNC_TREE_MODEL_ACCOUNT_COL_CLEARED,
67  GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT,
68  GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED,
69  GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_REPORT,
70  GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_DATE,
71  GNC_TREE_MODEL_ACCOUNT_COL_EARLIEST_DATE,
72  GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN,
73  GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN_REPORT,
74  GNC_TREE_MODEL_ACCOUNT_COL_TOTAL,
75  GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_REPORT,
76  GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_PERIOD,
77  GNC_TREE_MODEL_ACCOUNT_COL_NOTES,
78  GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO,
79  GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO_SUB_ACCT,
80  GNC_TREE_MODEL_ACCOUNT_COL_HIDDEN,
81  GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER,
82  GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE,
83 
84  GNC_TREE_MODEL_ACCOUNT_COL_LAST_VISIBLE = GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE,
85 
86  /* internal hidden columns */
87  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT,
88  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_ACCOUNT,
89  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE,
90  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE_PERIOD,
91  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED,
92  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED,
93  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_FUTURE_MIN,
94  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL,
95  GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL_PERIOD,
96 
97  GNC_TREE_MODEL_ACCOUNT_NUM_COLUMNS
98 } GncTreeModelAccountColumn;
99 
104 void gnc_tree_model_account_clear_cache (GncTreeModelAccount *model);
105 
113 GtkTreeModel *gnc_tree_model_account_new (Account *root);
132 Account *gnc_tree_model_account_get_account (GncTreeModelAccount *model,
133  GtkTreeIter *iter);
134 
135 
152 gboolean gnc_tree_model_account_get_iter_from_account (GncTreeModelAccount *model,
153  Account *account,
154  GtkTreeIter *iter);
155 
156 
170 GtkTreePath *gnc_tree_model_account_get_path_from_account (GncTreeModelAccount *model,
171  Account *account);
174 G_END_DECLS
175 
176 #endif /* __GNC_TREE_MODEL_ACCOUNT_H */
177 
STRUCTS.
Account * gnc_tree_model_account_get_account(GncTreeModelAccount *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash account.
GtkTreeModel implementation for a generic gnucash tree.
gboolean gnc_tree_model_account_get_iter_from_account(GncTreeModelAccount *model, Account *account, GtkTreeIter *iter)
Convert a model/account pair into a gtk_tree_model_iter.
void gnc_tree_model_account_clear_cache(GncTreeModelAccount *model)
Clear the tree model account cached values.
Account handling public routines.
GtkTreeModel * gnc_tree_model_account_new(Account *root)
Create a new GtkTreeModel for manipulating gnucash accounts.
GtkTreePath * gnc_tree_model_account_get_path_from_account(GncTreeModelAccount *model, Account *account)
Convert a model/account pair into a gtk_tree_model_path.