|
GnuCash 2.4.99
|
00001 /********************************************************************\ 00002 * gnc-ledger-display.h -- utilities for dealing with multiple * 00003 * register/ledger windows in GnuCash * 00004 * * 00005 * Copyright (C) 1997 Robin D. Clark * 00006 * Copyright (C) 1997, 1998 Linas Vepstas * 00007 * Copyright (C) 2001 Linux Developers Group * 00008 * * 00009 * This program is free software; you can redistribute it and/or * 00010 * modify it under the terms of the GNU General Public License as * 00011 * published by the Free Software Foundation; either version 2 of * 00012 * the License, or (at your option) any later version. * 00013 * * 00014 * This program is distributed in the hope that it will be useful, * 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00017 * GNU General Public License for more details. * 00018 * * 00019 * You should have received a copy of the GNU General Public License* 00020 * along with this program; if not, write to the Free Software * 00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00022 * * 00023 \********************************************************************/ 00024 00025 #ifndef GNC_LEDGER_DISPLAY_H 00026 #define GNC_LEDGER_DISPLAY_H 00027 00028 #include <glib.h> 00029 00030 #include "Account.h" 00031 #include "Query.h" 00032 #include "split-register.h" 00033 #include "SchedXaction.h" 00034 #include "Transaction.h" 00035 00036 00039 /* The GNCLedgerDisplay struct describes a single register/ledger 00040 * instance. It has a SplitRegister specially configured for 00041 * displaying the results of a Query. It also stores the Query. */ 00042 typedef struct gnc_ledger_display GNCLedgerDisplay; 00043 00044 typedef void (*GNCLedgerDisplayDestroy) (GNCLedgerDisplay *ld); 00045 typedef GtkWidget *(*GNCLedgerDisplayGetParent) (GNCLedgerDisplay *ld); 00046 typedef void (*GNCLedgerDisplaySetHelp) (GNCLedgerDisplay *ld, 00047 const char *help_str); 00048 00049 typedef enum 00050 { 00051 LD_SINGLE, 00052 LD_SUBACCOUNT, 00053 LD_GL, 00054 } GNCLedgerDisplayType; 00055 00056 00059 /* returns the 'lead' account of a ledger display, or NULL if none. */ 00060 Account * gnc_ledger_display_leader (GNCLedgerDisplay *ld); 00061 00062 GNCLedgerDisplayType gnc_ledger_display_type (GNCLedgerDisplay *ld); 00063 00064 /* get and set the user data associated with the ledger */ 00065 void gnc_ledger_display_set_user_data (GNCLedgerDisplay *ld, 00066 gpointer user_data); 00067 gpointer gnc_ledger_display_get_user_data (GNCLedgerDisplay *ld); 00068 00069 /* set the handlers used by the ledger display */ 00070 void gnc_ledger_display_set_handlers (GNCLedgerDisplay *ld, 00071 GNCLedgerDisplayDestroy destroy, 00072 GNCLedgerDisplayGetParent get_parent); 00073 00075 GtkWidget *gnc_ledger_display_get_parent( GNCLedgerDisplay *ld ); 00076 00077 /* return the split register associated with a ledger display */ 00078 SplitRegister * gnc_ledger_display_get_split_register (GNCLedgerDisplay *ld); 00079 00080 /* opens up a register window to display a single account */ 00081 GNCLedgerDisplay * gnc_ledger_display_simple (Account *account); 00082 00083 /* opens up a register window to display the parent account and all of 00084 * its children. */ 00085 GNCLedgerDisplay * gnc_ledger_display_subaccounts (Account *account); 00086 00087 /* opens up a general ledger window */ 00088 GNCLedgerDisplay * gnc_ledger_display_gl (void); 00089 00097 GNCLedgerDisplay * gnc_ledger_display_template_gl (char *id); 00098 00099 /* display a general ledger for an arbitrary query */ 00100 GNCLedgerDisplay * gnc_ledger_display_query (Query *query, 00101 SplitRegisterType type, 00102 SplitRegisterStyle style); 00103 00104 /* Set the query used for a register. */ 00105 void gnc_ledger_display_set_query (GNCLedgerDisplay *ledger_display, 00106 Query *q); 00107 00108 /* return the query associated with a ledger */ 00109 Query * gnc_ledger_display_get_query (GNCLedgerDisplay *ld); 00110 00111 /* If the given ledger display still exists, return it. Otherwise, 00112 * return NULL */ 00113 GNCLedgerDisplay * gnc_ledger_display_find_by_query (Query *q); 00114 00115 /* redisplay/redraw only the indicated window. Both routines do same 00116 * thing, they differ only by the argument they take. */ 00117 void gnc_ledger_display_refresh (GNCLedgerDisplay * ledger_display); 00118 void gnc_ledger_display_refresh_by_split_register (SplitRegister *reg); 00119 00120 /* close the window */ 00121 void gnc_ledger_display_close (GNCLedgerDisplay * ledger_display); 00122 00123 /* Returns a boolean of whether this display should be single or double lined 00124 * mode by default */ 00125 gboolean gnc_ledger_display_default_double_line (GNCLedgerDisplay *gld); 00126 00127 #endif
1.7.4