GnuCash  4.11-148-gc20d717b33+
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 #define GNC_TREE_MODEL_PRICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_PRICE, GncTreeModelPrice))
49 #define GNC_TREE_MODEL_PRICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL_PRICE, GncTreeModelPriceClass))
50 #define GNC_IS_TREE_MODEL_PRICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL_PRICE))
51 #define GNC_IS_TREE_MODEL_PRICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL_PRICE))
52 #define GNC_TREE_MODEL_PRICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL_PRICE, GncTreeModelPriceClass))
53 #define GNC_TREE_MODEL_PRICE_NAME "GncTreeModelPrice"
54 
55 
56 typedef enum
57 {
58  GNC_TREE_MODEL_PRICE_COL_COMMODITY,
59  GNC_TREE_MODEL_PRICE_COL_CURRENCY,
60  GNC_TREE_MODEL_PRICE_COL_DATE,
61  GNC_TREE_MODEL_PRICE_COL_SOURCE,
62  GNC_TREE_MODEL_PRICE_COL_TYPE,
63  GNC_TREE_MODEL_PRICE_COL_VALUE,
64 
65  GNC_TREE_MODEL_PRICE_COL_LAST_VISIBLE = GNC_TREE_MODEL_PRICE_COL_VALUE,
66 
67  /* internal hidden columns */
68  GNC_TREE_MODEL_PRICE_COL_VISIBILITY,
69  GNC_TREE_MODEL_PRICE_NUM_COLUMNS
70 } GncTreeModelPriceColumn;
71 
72 /* typedefs & structures */
73 
75 typedef struct
76 {
78  int stamp;
81 
82 
84 typedef struct
85 {
88 
89 
95 
96 
107 GtkTreeModel *gnc_tree_model_price_new (QofBook *book, GNCPriceDB *price_db);
127  GtkTreeIter *iter);
128 
129 
143  GtkTreeIter *iter);
144 
145 
159  GtkTreeIter *iter);
160 
161 
173 gnc_commodity_namespace *gnc_tree_model_price_get_namespace (GncTreeModelPrice *model,
174  GtkTreeIter *iter);
175 
176 
189  GtkTreeIter *iter);
190 
191 
204  GtkTreeIter *iter);
223  gnc_commodity_namespace *name_space,
224  GtkTreeIter *iter);
225 
237  gnc_commodity *commodity,
238  GtkTreeIter *iter);
239 
251  GNCPrice *price,
252  GtkTreeIter *iter);
253 
265  GNCPrice *price);
269 G_END_DECLS
270 
271 #endif /* __GNC_TREE_MODEL_PRICE_H */
272 
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.
int stamp
The state of the model.
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.
The instance data structure for a generic tree model.
gnc_commodity_namespace * gnc_tree_model_price_get_namespace(GncTreeModelPrice *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash commodity namespace.
The class data structure for a generic tree model.
GtkTreeModel implementation for a generic gnucash tree.
GncTreeModelClass gnc_tree_model
The parent object data.
gboolean gnc_tree_model_price_iter_is_namespace(GncTreeModelPrice *model, GtkTreeIter *iter)
Determine whether or not the specified GtkTreeIter points to a "commodity namespace".
The class data structure for a price tree model.
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.
GType gnc_tree_model_price_get_type(void)
Get the type of a price tree plugin.
GtkTreeModel * gnc_tree_model_price_new(QofBook *book, GNCPriceDB *price_db)
Create a new GtkTreeModel for manipulating gnucash commodity prices.
GncTreeModel gnc_tree_model
The parent object data.
GtkTreePath * gnc_tree_model_price_get_path_from_price(GncTreeModelPrice *model, GNCPrice *price)
Convert a price pointer into a GtkTreePath.
The instance data structure for a price tree model.
gboolean gnc_tree_model_price_get_iter_from_commodity(GncTreeModelPrice *model, gnc_commodity *commodity, GtkTreeIter *iter)
Convert a commodity pointer into a GtkTreeIter.