GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gnc-ledger-display2.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  * Copyright (C) 2012 Robert Fewell *
9  * *
10  * This program is free software; you can redistribute it and/or *
11  * modify it under the terms of the GNU General Public License as *
12  * published by the Free Software Foundation; either version 2 of *
13  * the License, or (at your option) any later version. *
14  * *
15  * This program is distributed in the hope that it will be useful, *
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18  * GNU General Public License for more details. *
19  * *
20  * You should have received a copy of the GNU General Public License*
21  * along with this program; if not, write to the Free Software *
22  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
23  * *
24 \********************************************************************/
25 
26 #ifndef GNC_LEDGER_DISPLAY2_H
27 #define GNC_LEDGER_DISPLAY2_H
28 
29 #include <glib.h>
30 
31 #include "Account.h"
32 #include "Query.h"
33 
34 #include "split-register.h"
35 
36 #include "SchedXaction.h"
37 #include "Transaction.h"
38 #include "gnc-tree-model-split-reg.h"
39 #include "gnc-tree-view-split-reg.h"
40 
43 /* The GNCLedgerDisplay2 struct describes a single register/ledger
44  * instance. It has a SplitRegister specially configured for
45  * displaying the results of a Query. It also stores the Query. */
47 
48 typedef void (*GNCLedgerDisplay2Destroy) (GNCLedgerDisplay2 *ld);
49 typedef GtkWidget *(*GNCLedgerDisplay2GetParent) (GNCLedgerDisplay2 *ld);
50 typedef void (*GNCLedgerDisplay2SetHelp) (GNCLedgerDisplay2 *ld,
51  const char *help_str);
52 
53 
54 typedef enum
55 {
56  LD2_SINGLE,
57  LD2_SUBACCOUNT,
58  LD2_GL,
59 } GNCLedgerDisplay2Type;
60 
61 
64 /* returns the 'lead' account of a ledger display, or NULL if none. */
65 Account * gnc_ledger_display2_leader (GNCLedgerDisplay2 *ld);
66 
67 GNCLedgerDisplay2Type gnc_ledger_display2_type (GNCLedgerDisplay2 *ld);
68 
69 /* get and set the user data associated with the ledger */
70 void gnc_ledger_display2_set_user_data (GNCLedgerDisplay2 *ld,
71  gpointer user_data);
72 gpointer gnc_ledger_display2_get_user_data (GNCLedgerDisplay2 *ld);
73 
74 /* set the handlers used by the ledger display */
75 void gnc_ledger_display2_set_handlers (GNCLedgerDisplay2 *ld,
76  GNCLedgerDisplay2Destroy destroy,
77  GNCLedgerDisplay2GetParent get_parent);
78 
79 /* Set and Get the tree view used by the ledger display */
80 void gnc_ledger_display2_set_split_view_register (GNCLedgerDisplay2 *ld, GncTreeViewSplitReg *view);
81 GncTreeViewSplitReg * gnc_ledger_display2_get_split_view_register (GNCLedgerDisplay2 *ld);
82 
83 void gnc_ledger_display2_set_split_view_refresh (GNCLedgerDisplay2 *ld, gboolean ok);
84 
86 GtkWidget *gnc_ledger_display2_get_parent( GNCLedgerDisplay2 *ld );
87 
88 /* return the split register associated with a ledger display */
89 GncTreeModelSplitReg * gnc_ledger_display2_get_split_model_register (GNCLedgerDisplay2 *ld);
90 
91 /* opens up a register window to display a single account */
92 GNCLedgerDisplay2 * gnc_ledger_display2_simple (Account *account);
93 
94 /* opens up a register window to display the parent account and all of
95  * its children. */
96 GNCLedgerDisplay2 * gnc_ledger_display2_subaccounts (Account *account);
97 
98 /* opens up a general ledger window */
99 GNCLedgerDisplay2 * gnc_ledger_display2_gl (void);
100 
108 GNCLedgerDisplay2 * gnc_ledger_display2_template_gl (char *id);
109 
110 /* display a general ledger for an arbitrary query */
111 GNCLedgerDisplay2 * gnc_ledger_display2_query (Query *query,
112  SplitRegisterType2 type,
113  SplitRegisterStyle2 style);
114 
115 /* Set the query used for a register. */
116 void gnc_ledger_display2_set_query (GNCLedgerDisplay2 *ledger_display,
117  Query *q);
118 
119 /* return the query associated with a ledger */
120 Query * gnc_ledger_display2_get_query (GNCLedgerDisplay2 *ld);
121 
122 /* If the given ledger display still exists, return it. Otherwise,
123  * return NULL */
124 GNCLedgerDisplay2 * gnc_ledger_display2_find_by_query (Query *q);
125 
126 /* redisplay/redraw only the indicated window. Both routines do same
127  * thing, they differ only by the argument they take. */
128 void gnc_ledger_display2_refresh (GNCLedgerDisplay2 * ledger_display);
129 void gnc_ledger_display2_refresh_by_split_register (GncTreeModelSplitReg *model);
130 
131 /* This is used to load the register for the schedule */
132 void gnc_ledger_display2_refresh_sched (GNCLedgerDisplay2 *ld, GList *splits);
133 
134 /* Refilter the register */
135 void gnc_ledger_display2_refilter (GNCLedgerDisplay2 *ld);
136 
137 /* close the window */
138 void gnc_ledger_display2_close (GNCLedgerDisplay2 * ledger_display);
139 
140 /* Returns a boolean of whether this display should be single or double lined
141  * mode by default */
142 gboolean gnc_ledger_display2_default_double_line (GNCLedgerDisplay2 *gld);
143 
144 #endif
Account handling public routines.
API for checkbook register display area.
Scheduled Transactions public handling routines.
API for Transactions and Splits (journal entries)