GnuCash  5.6-150-g038405b370+
gnc-tree-model-commodity.h
Go to the documentation of this file.
1 /*
2  * gnc-tree-model-commodity.h -- GtkTreeModel implementation to
3  * display commodities 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_COMMODITY_H
37 #define __GNC_TREE_MODEL_COMMODITY_H
38 
39 #include <gtk/gtk.h>
40 #include "gnc-tree-model.h"
41 
42 #include "gnc-commodity.h"
43 
44 G_BEGIN_DECLS
45 
46 /* type macros */
47 #define GNC_TYPE_TREE_MODEL_COMMODITY (gnc_tree_model_commodity_get_type ())
48 G_DECLARE_FINAL_TYPE (GncTreeModelCommodity, gnc_tree_model_commodity, GNC, TREE_MODEL_COMMODITY, GncTreeModel)
49 
50 #define GNC_TREE_MODEL_COMMODITY_NAME "GncTreeModelCommodity"
51 
52 
53 typedef enum
54 {
55  GNC_TREE_MODEL_COMMODITY_COL_NAMESPACE,
56  GNC_TREE_MODEL_COMMODITY_COL_MNEMONIC,
57  GNC_TREE_MODEL_COMMODITY_COL_USER_SYMBOL,
58  GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
59  GNC_TREE_MODEL_COMMODITY_COL_PRINTNAME,
60  GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME,
61  GNC_TREE_MODEL_COMMODITY_COL_CUSIP,
62  GNC_TREE_MODEL_COMMODITY_COL_FRACTION,
63  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_FLAG,
64  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_SOURCE,
65  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ,
66 
67  GNC_TREE_MODEL_COMMODITY_COL_LAST_VISIBLE = GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ,
68 
69  /* internal hidden columns */
70  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
71 
72  GNC_TREE_MODEL_COMMODITY_NUM_COLUMNS
73 } GncTreeModelCommodityColumn;
74 
84 GtkTreeModel *gnc_tree_model_commodity_new (QofBook *book, gnc_commodity_table *ct);
103 gboolean gnc_tree_model_commodity_iter_is_namespace (GncTreeModelCommodity *model,
104  GtkTreeIter *iter);
105 
106 
119 gboolean gnc_tree_model_commodity_iter_is_commodity (GncTreeModelCommodity *model,
120  GtkTreeIter *iter);
121 
122 
134 gnc_commodity_namespace *gnc_tree_model_commodity_get_namespace (GncTreeModelCommodity *model,
135  GtkTreeIter *iter);
136 
148 gnc_commodity *gnc_tree_model_commodity_get_commodity (GncTreeModelCommodity *model,
149  GtkTreeIter *iter);
167 gboolean gnc_tree_model_commodity_get_iter_from_namespace (GncTreeModelCommodity *model,
168  gnc_commodity_namespace *name_space,
169  GtkTreeIter *iter);
170 
181 gboolean gnc_tree_model_commodity_get_iter_from_commodity (GncTreeModelCommodity *model,
182  gnc_commodity *commodity,
183  GtkTreeIter *iter);
184 
195 GtkTreePath *gnc_tree_model_commodity_get_path_from_commodity (GncTreeModelCommodity *model,
196  gnc_commodity *commodity);
199 G_END_DECLS
200 
201 #endif /* __GNC_TREE_MODEL_COMMODITY_H */
202 
gnc_commodity * gnc_tree_model_commodity_get_commodity(GncTreeModelCommodity *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash commodity.
gboolean gnc_tree_model_commodity_get_iter_from_commodity(GncTreeModelCommodity *model, gnc_commodity *commodity, GtkTreeIter *iter)
Convert a commodity pointer into a GtkTreeIter.
GtkTreePath * gnc_tree_model_commodity_get_path_from_commodity(GncTreeModelCommodity *model, gnc_commodity *commodity)
Convert a commodity pointer into a GtkTreePath.
gnc_commodity_namespace * gnc_tree_model_commodity_get_namespace(GncTreeModelCommodity *model, GtkTreeIter *iter)
Convert a model/iter pair to a gnucash commodity namespace.
GtkTreeModel implementation for a generic gnucash tree.
GtkTreeModel * gnc_tree_model_commodity_new(QofBook *book, gnc_commodity_table *ct)
Create a new GtkTreeModel for manipulating gnucash commodities.
gboolean gnc_tree_model_commodity_get_iter_from_namespace(GncTreeModelCommodity *model, gnc_commodity_namespace *name_space, GtkTreeIter *iter)
Convert a commodity namespace pointer into a GtkTreeIter.
gboolean gnc_tree_model_commodity_iter_is_commodity(GncTreeModelCommodity *model, GtkTreeIter *iter)
Determine whether or not the specified GtkTreeIter points to a commodity.
gboolean gnc_tree_model_commodity_iter_is_namespace(GncTreeModelCommodity *model, GtkTreeIter *iter)
Determine whether or not the specified GtkTreeIter points to a commodity namespace.
Commodity handling public routines.