1 /*
2  * gnc-plugin_page-owner-tree.h --
3  *
4  * Copyright (C) 2011 Geert Janssens <geert@kobaltwit.be>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, contact:
18  *
19  * Free Software Foundation           Voice:  +1-617-542-5942
20  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
21  * Boston, MA  02110-1301,  USA       gnu@gnu.org
22  */
23 
24 /** @addtogroup ContentPlugins
25     @{ */
26 /** @addtogroup GncPluginPageOwnerTree An Owner Tree Plugin
27     @{ */
28 /** @file gnc-plugin-page-owner-tree.h
29     @brief Functions providing a page which lists owners of one type. This type
30            can be vendors, customers or employees.
31     @author Copyright (C) 2011 Geert Janssens <geert@kobaltwit.be>
32 */
33 
34 #ifndef __GNC_PLUGIN_PAGE_OWNER_TREE_H
35 #define __GNC_PLUGIN_PAGE_OWNER_TREE_H
36 
37 #include <gtk/gtk.h>
38 
39 #include "gnc-plugin-page.h"
40 #include "gncOwner.h"
41 
42 G_BEGIN_DECLS
43 
44 /* type macros */
45 #define GNC_TYPE_PLUGIN_PAGE_OWNER_TREE            (gnc_plugin_page_owner_tree_get_type ())
46 #define GNC_PLUGIN_PAGE_OWNER_TREE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_PAGE_OWNER_TREE, GncPluginPageOwnerTree))
47 #define GNC_PLUGIN_PAGE_OWNER_TREE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_PAGE_OWNER_TREE, GncPluginPageOwnerTreeClass))
48 #define GNC_IS_PLUGIN_PAGE_OWNER_TREE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_PAGE_OWNER_TREE))
49 #define GNC_IS_PLUGIN_PAGE_OWNER_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_PAGE_OWNER_TREE))
50 #define GNC_PLUGIN_PAGE_OWNER_TREE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_PAGE_OWNER_TREE, GncPluginPageOwnerTreeClass))
51 
52 #define GNC_PLUGIN_PAGE_OWNER_TREE_NAME "GncPluginPageOwnerTree"
53 
54 /* typedefs & structures */
55 typedef struct
56 {
57     GncPluginPage gnc_plugin_page;
58 } GncPluginPageOwnerTree;
59 
60 typedef struct
61 {
62     GncPluginPageClass gnc_plugin_page;
63 
64     /* callbacks */
65     void (*owner_selected) (GncPluginPage *page,
66                             GncOwner      *owner);
67 
68 } GncPluginPageOwnerTreeClass;
69 
70 /* function prototypes */
71 
72 /** Retrieve the type number for an "owner tree" plugin page.
73  *
74  *  @return The type number.
75  */
76 GType gnc_plugin_page_owner_tree_get_type (void);
77 
78 
79 /** Create a new "owner tree" plugin page.
80  *
81  *  @param owner_type The owner type to create a page for. Can be any of
82  *         the owner types defined in GnuCash, like vendor, customer,...
83  *
84  *  @return The newly created plugin page.
85  */
86 GncPluginPage *gnc_plugin_page_owner_tree_new  (GncOwnerType owner_type);
87 
88 
89 /** Given a pointer to an owner tree plugin page, return the
90  *  selected owner (if any).
91  *
92  *  @param page The "owner tree" page.
93  *
94  *  @return The currently selected owner.  NULL if no owner is
95  *  selected.
96  */
97 GncOwner * gnc_plugin_page_owner_tree_get_current_owner (GncPluginPageOwnerTree *page);
98 
99 G_END_DECLS
100 
101 #endif /* __GNC_PLUGIN_PAGE_OWNER_TREE_H */
102 /** @} */
103 /** @} */
104