GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gnc-tree-view-account.h
Go to the documentation of this file.
1 /**********************************************************************\
2  * gnc-tree-view-account.h -- GtkTreeView implementation to display *
3  * accounts in a GtkTreeView. *
4  * Copyright (C) 2003,2005,2006 David Hampton <[email protected]> *
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 [email protected] *
22  * *
23 \**********************************************************************/
24 
34 #ifndef __GNC_TREE_VIEW_ACCOUNT_H
35 #define __GNC_TREE_VIEW_ACCOUNT_H
36 
37 #include <gtk/gtk.h>
38 #include "gnc-tree-view.h"
39 
40 #include "gnc-ui-util.h"
41 #include "gnc-plugin-page.h"
42 
43 G_BEGIN_DECLS
44 
45 /* type macros */
46 #define GNC_TYPE_TREE_VIEW_ACCOUNT (gnc_tree_view_account_get_type ())
47 #define GNC_TREE_VIEW_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_ACCOUNT, GncTreeViewAccount))
48 #define GNC_TREE_VIEW_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_ACCOUNT, GncTreeViewAccountClass))
49 #define GNC_IS_TREE_VIEW_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_ACCOUNT))
50 #define GNC_IS_TREE_VIEW_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_ACCOUNT))
51 #define GNC_TREE_VIEW_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_ACCOUNT, GncTreeViewAccountClass))
52 #define GNC_TREE_VIEW_ACCOUNT_NAME "GncTreeViewAccount"
53 
54 /* typedefs & structures */
55 typedef struct AccountViewInfo_s AccountViewInfo;
56 
57 
59 {
60  gboolean include_type[NUM_ACCOUNT_TYPES];
61  gboolean show_hidden;
62 };
63 
64 
65 typedef struct
66 {
67  GncTreeView gnc_tree_view;
68  int stamp;
70 
71 typedef struct
72 {
73  GncTreeViewClass gnc_tree_view;
75 
76 typedef struct
77 {
78  GtkWidget *dialog;
79  GtkTreeModel *model;
80  GncTreeViewAccount *tree_view;
81  guint32 visible_types;
82  guint32 original_visible_types;
83  gboolean show_hidden;
84  gboolean original_show_hidden;
85  gboolean show_zero_total;
86  gboolean original_show_zero_total;
87  gboolean show_unused;
88  gboolean original_show_unused;
90 
91 void account_filter_dialog_create(AccountFilterDialog *fd,
92  GncPluginPage *page);
93 
95  gpointer user_data);
96 
97 /* "Filter By" dialog callbacks */
98 void gppat_filter_show_hidden_toggled_cb (GtkToggleButton *togglebutton,
100 void gppat_filter_show_zero_toggled_cb (GtkToggleButton *togglebutton,
101  AccountFilterDialog *fd);
102 void gppat_filter_show_unused_toggled_cb (GtkToggleButton *togglebutton,
103  AccountFilterDialog *fd);
104 void gppat_filter_clear_all_cb (GtkWidget *button, AccountFilterDialog *fd);
105 void gppat_filter_select_all_cb (GtkWidget *button, AccountFilterDialog *fd);
106 void gppat_filter_select_default_cb (GtkWidget *button,
107  AccountFilterDialog *fd);
108 void gppat_filter_response_cb (GtkWidget *dialog, gint response,
109  AccountFilterDialog *fd);
110 
111 /* Saving/Restoring */
112 void gnc_tree_view_account_save(GncTreeViewAccount *tree_view,
114  GKeyFile *key_file, const gchar *group_name);
115 void gnc_tree_view_account_restore(GncTreeViewAccount *view,
117  GKeyFile *key_file,
118  const gchar *group_name);
119 
120 
121 /* Get the GType for an GncTreeViewAccount object. */
122 GType gnc_tree_view_account_get_type (void);
123 
124 
140 GtkTreeView *gnc_tree_view_account_new_with_root (Account *root,
141  gboolean show_root);
142 
154 GtkTreeView *gnc_tree_view_account_new (gboolean show_root);
155 
162 typedef gchar * (*GncTreeViewAccountColumnSource) (Account *account,
163  GtkTreeViewColumn *col,
164  GtkCellRenderer *cell);
165 
166 typedef void (*GncTreeViewAccountColumnTextEdited) (Account *account,
167  GtkTreeViewColumn *col,
168  const gchar *new_text);
169 
170 
187 GtkTreeViewColumn * gnc_tree_view_account_add_custom_column(
188  GncTreeViewAccount *view, const gchar *column_title,
189  GncTreeViewAccountColumnSource source_cb,
190  GncTreeViewAccountColumnTextEdited edited_cb);
191 
192 void gnc_tree_view_account_set_name_edited(GncTreeViewAccount *view,
193  GncTreeViewAccountColumnTextEdited edited_cb);
194 void gnc_tree_view_account_name_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_name);
195 
196 void gnc_tree_view_account_set_code_edited(GncTreeViewAccount *view,
197  GncTreeViewAccountColumnTextEdited edited_cb);
198 void gnc_tree_view_account_code_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_code);
199 
200 void gnc_tree_view_account_set_description_edited(GncTreeViewAccount *view,
201  GncTreeViewAccountColumnTextEdited edited_cb);
202 void gnc_tree_view_account_description_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_desc);
203 
204 void gnc_tree_view_account_set_notes_edited(GncTreeViewAccount *view,
205  GncTreeViewAccountColumnTextEdited edited_cb);
206 void gnc_tree_view_account_notes_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_notes);
207 
219 GtkTreeViewColumn *
221  const gchar *column_title,
222  const gchar *propname);
223 
241  AccountViewInfo *avi);
242 
255  AccountViewInfo *avi);
256 
257 
266 typedef gboolean (*gnc_tree_view_account_filter_func)(Account *account, gpointer data);
267 
268 
290  gpointer data,
291  GSourceFunc destroy);
292 
293 /* This is a convenient filter function for use with
294  * gnc_tree_view_account_set_filter() and the functions in
295  * gnc-tree-model-account-types.h. If you have some view that is
296  * backed by the "account types" tree model, you can get a guint32
297  * from that view's tree selection. Then, you can use that account
298  * type selection as a filter for the account tree view. This also
299  * can filter by whether an account is hidden or not.
300  */
301 gboolean gnc_tree_view_account_filter_by_view_info(
302  Account* acct, gpointer data);
303 
304 
333  Account *account);
334 
335 
336 
348  GtkTreePath *path);
349 
350 
362  GtkTreeIter *iter);
363 
364 
374 
375 
388 
389 
406  Account *account);
407 
408 
421 
422 
445  GList *account_list,
446  gboolean show_last);
447 
448 
462  Account *account);
463 
472 
478 G_END_DECLS
479 
480 #endif /* __GNC_TREE_VIEW_ACCOUNT_H */
void gnc_tree_view_account_get_view_info(GncTreeViewAccount *account_view, AccountViewInfo *avi)
GtkTreeViewColumn * gnc_tree_view_account_add_property_column(GncTreeViewAccount *view, const gchar *column_title, const gchar *propname)
GList * gnc_tree_view_account_get_selected_accounts(GncTreeViewAccount *view)
Account * gnc_tree_view_account_get_cursor_account(GncTreeViewAccount *view)
utility functions for the GnuCash UI
void gppat_filter_response_cb(GtkWidget *dialog, gint response, AccountFilterDialog *fd)
common utilities for manipulating a GtkTreeView within gnucash
void gppat_filter_select_all_cb(GtkWidget *button, AccountFilterDialog *fd)
gboolean(* gnc_tree_view_account_filter_func)(Account *account, gpointer data)
void gnc_tree_view_account_expand_to_account(GncTreeViewAccount *view, Account *account)
void gnc_tree_view_account_set_view_info(GncTreeViewAccount *account_view, AccountViewInfo *avi)
void gppat_filter_clear_all_cb(GtkWidget *button, AccountFilterDialog *fd)
void gnc_tree_view_account_set_selected_accounts(GncTreeViewAccount *view, GList *account_list, gboolean show_last)
void gppat_filter_show_hidden_toggled_cb(GtkToggleButton *togglebutton, AccountFilterDialog *fd)
void gnc_tree_view_account_set_filter(GncTreeViewAccount *account_view, gnc_tree_view_account_filter_func func, gpointer data, GSourceFunc destroy)
void gnc_tree_view_account_select_subaccounts(GncTreeViewAccount *view, Account *account)
void gnc_tree_view_account_refilter(GncTreeViewAccount *view)
GtkTreeViewColumn * gnc_tree_view_account_add_custom_column(GncTreeViewAccount *view, const gchar *column_title, GncTreeViewAccountColumnSource source_cb, GncTreeViewAccountColumnTextEdited edited_cb)
GtkTreeView * gnc_tree_view_account_new_with_root(Account *root, gboolean show_root)
GtkTreeView * gnc_tree_view_account_new(gboolean show_root)
gboolean gnc_plugin_page_account_tree_filter_accounts(Account *account, gpointer user_data)
Functions for adding plugins to a GnuCash window.
Account * gnc_tree_view_account_get_account_from_iter(GtkTreeModel *model, GtkTreeIter *iter)
Account * gnc_tree_view_account_get_account_from_path(GncTreeViewAccount *view, GtkTreePath *path)
void gnc_tree_view_account_set_selected_account(GncTreeViewAccount *view, Account *account)
void gppat_filter_show_unused_toggled_cb(GtkToggleButton *togglebutton, AccountFilterDialog *fd)
gint gnc_tree_view_account_count_children(GncTreeViewAccount *view, Account *account)
Account * gnc_tree_view_account_get_selected_account(GncTreeViewAccount *view)
void gppat_filter_select_default_cb(GtkWidget *button, AccountFilterDialog *fd)
void gppat_filter_show_zero_toggled_cb(GtkToggleButton *togglebutton, AccountFilterDialog *fd)