GnuCash  4.11-148-gc20d717b33+
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 #define GNC_TREE_MODEL_COMMODITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_COMMODITY, GncTreeModelCommodity))
49 #define GNC_TREE_MODEL_COMMODITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL_COMMODITY, GncTreeModelCommodityClass))
50 #define GNC_IS_TREE_MODEL_COMMODITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL_COMMODITY))
51 #define GNC_IS_TREE_MODEL_COMMODITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL_COMMODITY))
52 #define GNC_TREE_MODEL_COMMODITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL_COMMODITY, GncTreeModelCommodityClass))
53 #define GNC_TREE_MODEL_COMMODITY_NAME "GncTreeModelCommodity"
54 
55 
56 typedef enum
57 {
58  GNC_TREE_MODEL_COMMODITY_COL_NAMESPACE,
59  GNC_TREE_MODEL_COMMODITY_COL_MNEMONIC,
60  GNC_TREE_MODEL_COMMODITY_COL_USER_SYMBOL,
61  GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
62  GNC_TREE_MODEL_COMMODITY_COL_PRINTNAME,
63  GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME,
64  GNC_TREE_MODEL_COMMODITY_COL_CUSIP,
65  GNC_TREE_MODEL_COMMODITY_COL_FRACTION,
66  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_FLAG,
67  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_SOURCE,
68  GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ,
69 
70  GNC_TREE_MODEL_COMMODITY_COL_LAST_VISIBLE = GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ,
71 
72  /* internal hidden columns */
73  GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
74 
75  GNC_TREE_MODEL_COMMODITY_NUM_COLUMNS
76 } GncTreeModelCommodityColumn;
77 
78 /* typedefs & structures */
79 
81 typedef struct
82 {
84  int stamp;
87 
88 
90 typedef struct
91 {
94 
95 
101 
102 
112 GtkTreeModel *gnc_tree_model_commodity_new (QofBook *book, gnc_commodity_table *ct);
132  GtkTreeIter *iter);
133 
134 
148  GtkTreeIter *iter);
149 
150 
162 gnc_commodity_namespace *gnc_tree_model_commodity_get_namespace (GncTreeModelCommodity *model,
163  GtkTreeIter *iter);
164 
177  GtkTreeIter *iter);
196  gnc_commodity_namespace *name_space,
197  GtkTreeIter *iter);
198 
210  gnc_commodity *commodity,
211  GtkTreeIter *iter);
212 
224  gnc_commodity *commodity);
227 G_END_DECLS
228 
229 #endif /* __GNC_TREE_MODEL_COMMODITY_H */
230 
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.
GncTreeModelClass gnc_tree_model
The parent object data.
The instance data structure for a generic tree model.
The class data structure for a generic tree model.
GtkTreeModel implementation for a generic gnucash tree.
int stamp
The state of the model.
GType gnc_tree_model_commodity_get_type(void)
Get the type of a commodity tree plugin.
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.
The class data structure for a commodity tree model.
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.
GncTreeModel gnc_tree_model
The parent object data.
The instance data structure for a commodity tree model.