|
GnuCash 2.4.99
|
00001 /********************************************************************\ 00002 * gnc-tree-view-account.h -- GtkTreeView implementation to display * 00003 * accounts in a GtkTreeView. * 00004 * Copyright (C) 2003,2005,2006 David Hampton <hampton@employees.org> * 00005 * * 00006 * This program is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU General Public License as * 00008 * published by the Free Software Foundation; either version 2 of * 00009 * the License, or (at your option) any later version. * 00010 * * 00011 * This program is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License* 00017 * along with this program; if not, contact: * 00018 * * 00019 * Free Software Foundation Voice: +1-617-542-5942 * 00020 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 00021 * Boston, MA 02110-1301, USA gnu@gnu.org * 00022 * * 00023 \********************************************************************/ 00024 00034 #ifndef __GNC_TREE_VIEW_ACCOUNT_H 00035 #define __GNC_TREE_VIEW_ACCOUNT_H 00036 00037 #include <gtk/gtk.h> 00038 #include "gnc-tree-view.h" 00039 00040 #include "gnc-ui-util.h" 00041 #include "gnc-plugin-page.h" 00042 00043 G_BEGIN_DECLS 00044 00045 /* type macros */ 00046 #define GNC_TYPE_TREE_VIEW_ACCOUNT (gnc_tree_view_account_get_type ()) 00047 #define GNC_TREE_VIEW_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_ACCOUNT, GncTreeViewAccount)) 00048 #define GNC_TREE_VIEW_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_ACCOUNT, GncTreeViewAccountClass)) 00049 #define GNC_IS_TREE_VIEW_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_ACCOUNT)) 00050 #define GNC_IS_TREE_VIEW_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_ACCOUNT)) 00051 #define GNC_TREE_VIEW_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_ACCOUNT, GncTreeViewAccountClass)) 00052 #define GNC_TREE_VIEW_ACCOUNT_NAME "GncTreeViewAccount" 00053 00054 /* typedefs & structures */ 00055 typedef struct AccountViewInfo_s AccountViewInfo; 00056 00057 00058 struct AccountViewInfo_s 00059 { 00060 gboolean include_type[NUM_ACCOUNT_TYPES]; 00061 gboolean show_hidden; 00062 }; 00063 00064 00065 typedef struct 00066 { 00067 GncTreeView gnc_tree_view; 00068 int stamp; 00069 } GncTreeViewAccount; 00070 00071 typedef struct 00072 { 00073 GncTreeViewClass gnc_tree_view; 00074 } GncTreeViewAccountClass; 00075 00076 typedef struct 00077 { 00078 GtkWidget *dialog; 00079 GtkTreeModel *model; 00080 GncTreeViewAccount *tree_view; 00081 guint32 visible_types; 00082 guint32 original_visible_types; 00083 gboolean show_hidden; 00084 gboolean original_show_hidden; 00085 gboolean show_zero_total; 00086 gboolean original_show_zero_total; 00087 } AccountFilterDialog; 00088 00089 void account_filter_dialog_create(AccountFilterDialog *fd, 00090 GncPluginPage *page); 00091 00092 gboolean gnc_plugin_page_account_tree_filter_accounts (Account *account, 00093 gpointer user_data); 00094 00095 /* "Filter By" dialog callbacks */ 00096 void gppat_filter_show_hidden_toggled_cb (GtkToggleButton *togglebutton, 00097 AccountFilterDialog *fd); 00098 void gppat_filter_show_zero_toggled_cb (GtkToggleButton *togglebutton, 00099 AccountFilterDialog *fd); 00100 void gppat_filter_clear_all_cb (GtkWidget *button, AccountFilterDialog *fd); 00101 void gppat_filter_select_all_cb (GtkWidget *button, AccountFilterDialog *fd); 00102 void gppat_filter_select_default_cb (GtkWidget *button, 00103 AccountFilterDialog *fd); 00104 void gppat_filter_response_cb (GtkWidget *dialog, gint response, 00105 AccountFilterDialog *fd); 00106 00107 /* Saving/Restoring */ 00108 void gnc_tree_view_account_save(GncTreeViewAccount *tree_view, 00109 AccountFilterDialog *fd, 00110 GKeyFile *key_file, const gchar *group_name); 00111 void gnc_tree_view_account_restore(GncTreeViewAccount *view, 00112 AccountFilterDialog *fd, 00113 GKeyFile *key_file, 00114 const gchar *group_name); 00115 00116 00117 /* Get the GType for an GncTreeViewAccount object. */ 00118 GType gnc_tree_view_account_get_type (void); 00119 00120 00136 GtkTreeView *gnc_tree_view_account_new_with_root (Account *root, 00137 gboolean show_root); 00138 00150 GtkTreeView *gnc_tree_view_account_new (gboolean show_root); 00151 00158 typedef gchar * (*GncTreeViewAccountColumnSource) (Account *account, 00159 GtkTreeViewColumn *col, 00160 GtkCellRenderer *cell); 00161 00162 typedef void (*GncTreeViewAccountColumnTextEdited) (Account *account, 00163 GtkTreeViewColumn *col, 00164 const gchar *new_text); 00165 00166 00183 GtkTreeViewColumn * gnc_tree_view_account_add_custom_column( 00184 GncTreeViewAccount *view, const gchar *column_title, 00185 GncTreeViewAccountColumnSource source_cb, 00186 GncTreeViewAccountColumnTextEdited edited_cb); 00187 00188 void gnc_tree_view_account_set_name_edited(GncTreeViewAccount *view, 00189 GncTreeViewAccountColumnTextEdited edited_cb); 00190 void gnc_tree_view_account_name_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_name); 00191 00192 void gnc_tree_view_account_set_code_edited(GncTreeViewAccount *view, 00193 GncTreeViewAccountColumnTextEdited edited_cb); 00194 void gnc_tree_view_account_code_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_code); 00195 00196 void gnc_tree_view_account_set_description_edited(GncTreeViewAccount *view, 00197 GncTreeViewAccountColumnTextEdited edited_cb); 00198 void gnc_tree_view_account_description_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_desc); 00199 00200 void gnc_tree_view_account_set_notes_edited(GncTreeViewAccount *view, 00201 GncTreeViewAccountColumnTextEdited edited_cb); 00202 void gnc_tree_view_account_notes_edited_cb(Account *account, GtkTreeViewColumn *col, const gchar *new_notes); 00203 00216 GtkTreeViewColumn * 00217 gnc_tree_view_account_add_kvp_column (GncTreeViewAccount *view, 00218 const gchar *column_title, 00219 const gchar *kvp_key); 00220 00237 void gnc_tree_view_account_get_view_info (GncTreeViewAccount *account_view, 00238 AccountViewInfo *avi); 00239 00251 void gnc_tree_view_account_set_view_info (GncTreeViewAccount *account_view, 00252 AccountViewInfo *avi); 00253 00254 00263 typedef gboolean (*gnc_tree_view_account_filter_func)(Account *account, gpointer data); 00264 00265 00285 void gnc_tree_view_account_set_filter (GncTreeViewAccount *account_view, 00286 gnc_tree_view_account_filter_func func, 00287 gpointer data, 00288 GtkFunction destroy); 00289 00290 /* This is a convenient filter function for use with 00291 * gnc_tree_view_account_set_filter() and the functions in 00292 * gnc-tree-model-account-types.h. If you have some view that is 00293 * backed by the "account types" tree model, you can get a guint32 00294 * from that view's tree selection. Then, you can use that account 00295 * type selection as a filter for the account tree view. This also 00296 * can filter by whether an account is hidden or not. 00297 */ 00298 gboolean gnc_tree_view_account_filter_by_view_info( 00299 Account* acct, gpointer data); 00300 00301 00312 void gnc_tree_view_account_refilter (GncTreeViewAccount *view); 00329 gint gnc_tree_view_account_count_children (GncTreeViewAccount *view, 00330 Account *account); 00331 00332 00333 00344 Account * gnc_tree_view_account_get_account_from_path (GncTreeViewAccount *view, 00345 GtkTreePath *path); 00346 00347 00358 Account * gnc_tree_view_account_get_account_from_iter (GtkTreeModel *model, 00359 GtkTreeIter *iter); 00360 00361 00370 Account * gnc_tree_view_account_get_cursor_account (GncTreeViewAccount *view); 00371 00372 00384 Account * gnc_tree_view_account_get_selected_account (GncTreeViewAccount *view); 00385 00386 00402 void gnc_tree_view_account_set_selected_account (GncTreeViewAccount *view, 00403 Account *account); 00404 00405 00417 GList * gnc_tree_view_account_get_selected_accounts (GncTreeViewAccount *view); 00418 00419 00441 void gnc_tree_view_account_set_selected_accounts (GncTreeViewAccount *view, 00442 GList *account_list, 00443 gboolean show_last); 00444 00445 00458 void gnc_tree_view_account_select_subaccounts (GncTreeViewAccount *view, 00459 Account *account); 00460 00468 void gnc_tree_view_account_expand_to_account (GncTreeViewAccount *view, Account *account); 00469 00475 G_END_DECLS 00476 00477 #endif /* __GNC_TREE_VIEW_ACCOUNT_H */
1.7.4