GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gnc-ledger-display.h
1 /********************************************************************\
2  * gnc-ledger-display.h -- utilities for dealing with multiple *
3  * register/ledger windows in GnuCash *
4  * *
5  * Copyright (C) 1997 Robin D. Clark *
6  * Copyright (C) 1997, 1998 Linas Vepstas *
7  * Copyright (C) 2001 Linux Developers Group *
8  * *
9  * This program is free software; you can redistribute it and/or *
10  * modify it under the terms of the GNU General Public License as *
11  * published by the Free Software Foundation; either version 2 of *
12  * the License, or (at your option) any later version. *
13  * *
14  * This program is distributed in the hope that it will be useful, *
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17  * GNU General Public License for more details. *
18  * *
19  * You should have received a copy of the GNU General Public License*
20  * along with this program; if not, write to the Free Software *
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
22  * *
23 \********************************************************************/
24 
25 #ifndef GNC_LEDGER_DISPLAY_H
26 #define GNC_LEDGER_DISPLAY_H
27 
28 #include <glib.h>
29 
30 #include "Account.h"
31 #include "Query.h"
32 #include "split-register.h"
33 #include "SchedXaction.h"
34 #include "Transaction.h"
35 
36 
39 /* The GNCLedgerDisplay struct describes a single register/ledger
40  * instance. It has a SplitRegister specially configured for
41  * displaying the results of a Query. It also stores the Query. */
43 
44 typedef void (*GNCLedgerDisplayDestroy) (GNCLedgerDisplay *ld);
45 typedef GtkWidget *(*GNCLedgerDisplayGetParent) (GNCLedgerDisplay *ld);
46 typedef void (*GNCLedgerDisplaySetHelp) (GNCLedgerDisplay *ld,
47  const char *help_str);
48 
49 typedef enum
50 {
51  LD_SINGLE,
52  LD_SUBACCOUNT,
53  LD_GL,
54 } GNCLedgerDisplayType;
55 
56 
59 /* returns the 'lead' account of a ledger display, or NULL if none. */
60 Account * gnc_ledger_display_leader (GNCLedgerDisplay *ld);
61 
62 GNCLedgerDisplayType gnc_ledger_display_type (GNCLedgerDisplay *ld);
63 
64 /* get and set the user data associated with the ledger */
65 void gnc_ledger_display_set_user_data (GNCLedgerDisplay *ld,
66  gpointer user_data);
67 gpointer gnc_ledger_display_get_user_data (GNCLedgerDisplay *ld);
68 
69 /* set the handlers used by the ledger display */
70 void gnc_ledger_display_set_handlers (GNCLedgerDisplay *ld,
71  GNCLedgerDisplayDestroy destroy,
72  GNCLedgerDisplayGetParent get_parent);
73 
75 GtkWidget *gnc_ledger_display_get_parent( GNCLedgerDisplay *ld );
76 
77 /* return the split register associated with a ledger display */
78 SplitRegister * gnc_ledger_display_get_split_register (GNCLedgerDisplay *ld);
79 
80 /* opens up a register window to display a single account */
81 GNCLedgerDisplay * gnc_ledger_display_simple (Account *account);
82 
83 /* opens up a register window to display the parent account and all of
84  * its children. */
85 GNCLedgerDisplay * gnc_ledger_display_subaccounts (Account *account);
86 
87 /* opens up a general ledger window */
88 GNCLedgerDisplay * gnc_ledger_display_gl (void);
89 
97 GNCLedgerDisplay * gnc_ledger_display_template_gl (char *id);
98 
99 /* display a general ledger for an arbitrary query */
100 GNCLedgerDisplay * gnc_ledger_display_query (Query *query,
101  SplitRegisterType type,
102  SplitRegisterStyle style);
103 
104 /* Set the query used for a register. */
105 void gnc_ledger_display_set_query (GNCLedgerDisplay *ledger_display,
106  Query *q);
107 
108 /* return the query associated with a ledger */
109 Query * gnc_ledger_display_get_query (GNCLedgerDisplay *ld);
110 
111 /* If the given ledger display still exists, return it. Otherwise,
112  * return NULL */
113 GNCLedgerDisplay * gnc_ledger_display_find_by_query (Query *q);
114 
115 /* redisplay/redraw only the indicated window. Both routines do same
116  * thing, they differ only by the argument they take. */
117 void gnc_ledger_display_refresh (GNCLedgerDisplay * ledger_display);
118 void gnc_ledger_display_refresh_by_split_register (SplitRegister *reg);
119 
120 /* close the window */
121 void gnc_ledger_display_close (GNCLedgerDisplay * ledger_display);
122 
123 /* Returns a boolean of whether this display should be single or double lined
124  * mode by default */
125 gboolean gnc_ledger_display_default_double_line (GNCLedgerDisplay *gld);
126 
127 #endif
The type, style and table for the register.
SplitRegisterType
Register types.
Account handling public routines.
API for checkbook register display area.
Scheduled Transactions public handling routines.
SplitRegisterStyle
API for Transactions and Splits (journal entries)