GnuCash  5.6-150-g038405b370+
gnc-tree-model-price.h
Go to the documentation of this file.
1 /*
2  * gnc-tree-model-price.h -- GtkTreeModel implementation to display
3  * prices 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_PRICE_H
37 #define __GNC_TREE_MODEL_PRICE_H
38 
39 #include <gtk/gtk.h>
40 #include "gnc-tree-model.h"
41 
42 #include "gnc-pricedb.h"
43 
44 G_BEGIN_DECLS
45 
46 /* type macros */
47 #define GNC_TYPE_TREE_MODEL_PRICE (gnc_tree_model_price_get_type ())
48 G_DECLARE_FINAL_TYPE (GncTreeModelPrice, gnc_tree_model_price, GNC, TREE_MODEL_PRICE, GncTreeModel)
49 
50 #define GNC_TREE_MODEL_PRICE_NAME "GncTreeModelPrice"
51 
52 
53 typedef enum
54 {
55  GNC_TREE_MODEL_PRICE_COL_COMMODITY,
56  GNC_TREE_MODEL_PRICE_COL_CURRENCY,
57  GNC_TREE_MODEL_PRICE_COL_DATE,
58  GNC_TREE_MODEL_PRICE_COL_SOURCE,
59  GNC_TREE_MODEL_PRICE_COL_TYPE,
60  GNC_TREE_MODEL_PRICE_COL_VALUE,
61 
62  GNC_TREE_MODEL_PRICE_COL_LAST_VISIBLE = GNC_TREE_MODEL_PRICE_COL_VALUE,
63 
64  /* internal hidden columns */
65  GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
66  GNC_TREE_MODEL_PRICE_NUM_COLUMNS
67 } GncTreeModelPriceColumn;
68 
79 GtkTreeModel *gnc_tree_model_price_new (QofBook *book, GNCPriceDB *price_db);
98 gboolean gnc_tree_model_price_iter_is_namespace (GncTreeModelPrice *model,
99  GtkTreeIter *iter);
100 
101 
114 gboolean gnc_tree_model_price_iter_is_commodity (GncTreeModelPrice *model,
115  GtkTreeIter *iter);
116 
117 
130 gboolean gnc_tree_model_price_iter_is_price (GncTreeModelPrice *model,
131  GtkTreeIter *iter);
132 
133 
145 gnc_commodity_namespace *gnc_tree_model_price_get_namespace (GncTreeModelPrice *model,
146  GtkTreeIter *iter);
147 
148 
160 gnc_commodity *gnc_tree_model_price_get_commodity (GncTreeModelPrice *model,
161  GtkTreeIter *iter);
162 
163 
175 GNCPrice *gnc_tree_model_price_get_price (GncTreeModelPrice *model,
176  GtkTreeIter *iter);
194 gboolean gnc_tree_model_price_get_iter_from_namespace (GncTreeModelPrice *model,
195  gnc_commodity_namespace *name_space,
196  GtkTreeIter *iter);
197 
208 gboolean gnc_tree_model_price_get_iter_from_commodity (GncTreeModelPrice *model,
209  gnc_commodity *commodity,
210  GtkTreeIter *iter);
211 
222 gboolean gnc_tree_model_price_get_iter_from_price (GncTreeModelPrice *model,
223  GNCPrice *price,
224  GtkTreeIter *iter);
225 
236 GtkTreePath *gnc_tree_model_price_get_path_from_price (GncTreeModelPrice *model,
237  GNCPrice *price);
241 G_END_DECLS
242 
243 #endif /* __GNC_TREE_MODEL_PRICE_H */
244 
gboolean gnc_tree_model_price_get_iter_from_price(GncTreeModelPrice *model, GNCPrice *price, GtkTreeIter *iter)
Convert a price pointer into a GtkTreeIter.
gnc_commodity * gnc_tree_model_price_get_commodity(GncTreeModelPrice *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash commodity.
a simple price database for gnucash
gboolean gnc_tree_model_price_get_iter_from_namespace(GncTreeModelPrice *model, gnc_commodity_namespace *name_space, GtkTreeIter *iter)
Convert a commodity namespace pointer into a GtkTreeIter.
GNCPrice * gnc_tree_model_price_get_price(GncTreeModelPrice *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash price.
gnc_commodity_namespace * gnc_tree_model_price_get_namespace(GncTreeModelPrice *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash commodity namespace.
GtkTreeModel implementation for a generic gnucash tree.
gboolean gnc_tree_model_price_iter_is_namespace(GncTreeModelPrice *model, GtkTreeIter *iter)
Determine whether or not the specified GtkTreeIter points to a "commodity namespace".
gboolean gnc_tree_model_price_iter_is_commodity(GncTreeModelPrice *model, GtkTreeIter *iter)
Determine whether or not the specified GtkTreeIter points to a commodity.
gboolean gnc_tree_model_price_iter_is_price(GncTreeModelPrice *model, GtkTreeIter *iter)
Determine whether or not the specified GtkTreeIter points to a price.
GtkTreeModel * gnc_tree_model_price_new(QofBook *book, GNCPriceDB *price_db)
Create a new GtkTreeModel for manipulating gnucash commodity prices.
GtkTreePath * gnc_tree_model_price_get_path_from_price(GncTreeModelPrice *model, GNCPrice *price)
Convert a price pointer into a GtkTreePath.
gboolean gnc_tree_model_price_get_iter_from_commodity(GncTreeModelPrice *model, gnc_commodity *commodity, GtkTreeIter *iter)
Convert a commodity pointer into a GtkTreeIter.