GnuCash c935c2f+
Loading...
Searching...
No Matches
gnc-split-reg.h
1/********************************************************************\
2 * gnc-split-reg.h -- A widget for the common register look-n-feel. *
3 * Copyright (C) 1997 Robin D. Clark *
4 * Copyright (C) 1997-1998 Linas Vepstas <linas@linas.org> *
5 * Copyright (C) 1998 Rob Browning <rlb@cs.utexas.edu> *
6 * Copyright (C) 1999-2000 Dave Peticolas <dave@krondo.com> *
7 * Copyright (C) 2001 Gnumatic, Inc. *
8 * Copyright (C) 2002,2006 Joshua Sled <jsled@asynchronous.org> *
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, contact: *
22 * *
23 * Free Software Foundation Voice: +1-617-542-5942 *
24 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
25 * Boston, MA 02110-1301, USA gnu@gnu.org *
26\********************************************************************/
27
28
29#ifndef GNC_SPLIT_REG_H
30#define GNC_SPLIT_REG_H
31
32#include "gnc-ledger-display.h"
33#include "gnucash-register.h"
34
35#ifdef __cplusplus
36extern "C"
37{
38#endif
39
40#define GNC_SPLIT_REG(obj) G_TYPE_CHECK_INSTANCE_CAST( obj, gnc_split_reg_get_type(), GNCSplitReg )
41#define GNC_SPLIT_REG_CLASS(klass) G_TYPE_CHECK_CLASS_CAST( klass, gnc_split_reg_get_type(), GNCSplitRegClass )
42#define IS_GNC_SPLIT_REG(obj) G_TYPE_CHECK_INSTANCE_TYPE( obj, gnc_split_reg_get_type() )
43
44#define STATE_SECTION_REG_PREFIX "Register"
45#define KEY_PAGE_SORT "register_order"
46#define KEY_PAGE_SORT_REV "register_reversed"
47#define KEY_PAGE_FILTER "register_filter"
48
49typedef struct _GNCSplitReg GNCSplitReg;
50typedef struct _GNCSplitRegClass GNCSplitRegClass;
51
52typedef enum { no_force, force } ForceSort;
53typedef enum { no_refresh, refresh } Refresh;
54
56{
57 /* The "parent" widget. */
58 GtkBox vbox;
59
60 /* The containing window. */
61 GtkWidget *window;
62 gint width;
63 gint height;
64
65 GtkWidget *toolbar;
66 GtkWidget *summarybar;
67
68 GtkWidget *popup_menu;
69
70 GtkWidget *edit_menu;
71 GtkWidget *view_menu;
72 GtkWidget *style_submenu;
73 GtkWidget *sort_submenu;
74 GtkWidget *action_menu;
75
76 GtkWidget * double_line_check;
77
78 GtkWidget *split_button;
79 GtkWidget *split_menu_check;
80 GtkWidget *split_popup_check;
81
82 /* Summary Bar Labels */
83 GtkWidget *balance_label;
84 GtkWidget *cleared_label;
85 GtkWidget *reconciled_label;
86 GtkWidget *future_label;
87 GtkWidget *projectedminimum_label;
88 GtkWidget *shares_label;
89 GtkWidget *value_label;
90 GtkWidget *sort_label;
91 GtkWidget *sort_arrow;
92 GtkWidget *filter_label;
93
95 GNCLedgerDisplay *ledger;
97 GnucashRegister *reg;
98
99 gint numRows;
100
101 guint sort_type;
102 gboolean sort_rev;
103 gulong sort_arrow_handler_id;
104 gchar *filter_text;
105
106 gboolean read_only;
107};
108
110{
111 GtkBoxClass parent_class;
112
113 /* Signal defaults */
114 void (*enter_ent_cb) ( GNCSplitReg *w, gpointer user_data );
115 void (*cancel_ent_cb) ( GNCSplitReg *w, gpointer user_data );
116 void (*delete_ent_cb) ( GNCSplitReg *w, gpointer user_data );
117 void (*reinit_ent_cb) ( GNCSplitReg *w, gpointer user_data );
118 void (*dup_ent_cb) ( GNCSplitReg *w, gpointer user_data );
119 void (*schedule_ent_cb) ( GNCSplitReg *w, gpointer user_data );
120 void (*expand_ent_cb) ( GNCSplitReg *w, gpointer user_data );
121 void (*blank_cb) ( GNCSplitReg *w, gpointer user_data );
122 void (*jump_cb) ( GNCSplitReg *w, gpointer user_data );
123 void (*cut_cb) ( GNCSplitReg *w, gpointer user_data );
124 void (*cut_txn_cb) ( GNCSplitReg *w, gpointer user_data );
125 void (*copy_cb) ( GNCSplitReg *w, gpointer user_data );
126 void (*copy_txn_cb) ( GNCSplitReg *w, gpointer user_data );
127 void (*paste_cb) ( GNCSplitReg *w, gpointer user_data );
128 void (*paste_txn_cb) ( GNCSplitReg *w, gpointer user_data );
129 void (*void_txn_cb) ( GNCSplitReg *w, gpointer user_data );
130 void (*unvoid_txn_cb) ( GNCSplitReg *w, gpointer user_data );
131 void (*reverse_txn_cb) ( GNCSplitReg *w, gpointer user_data );
132 void (*help_changed_cb) ( GNCSplitReg *w, gpointer user_data );
133 void (*show_popup_menu_cb) ( GNCSplitReg *w, gpointer user_data );
134};
135/* Something somewhere sets these to silly values and causes problems */
136#undef DELETE
137#undef DUPLICATE
138typedef enum
139{
140 ENTER,
141 CANCEL,
142 DELETE,
143 REINIT,
144 DUPLICATE,
145 SCHEDULE,
146 SPLIT,
147 BLANK,
148 JUMP,
149 CUT,
150 CUT_TXN,
151 COPY,
152 COPY_TXN,
153 PASTE,
154 PASTE_TXN,
155 SORT_ORDER_SUBMENU,
156 STYLE_SUBMENU,
157} GNC_SPLIT_REG_ITEM;
158
159/* Easy way to pass the sort-type
160 * Note that this is STUPID -- we should be using parameter lists,
161 * but this provides a simple case statement internally. This should
162 * probably not actually be exposed in the external interface....
163 */
164#define ENUM_LIST_SORTTYPE(_) \
165 _(BY_NONE,) \
166 _(BY_STANDARD,) \
167 _(BY_DATE,) \
168 _(BY_DATE_ENTERED,) \
169 _(BY_DATE_RECONCILED,) \
170 _(BY_NUM,) \
171 _(BY_AMOUNT,) \
172 _(BY_MEMO,) \
173 _(BY_DESC,) \
174 _(BY_ACTION,) \
175 _(BY_NOTES,)
176
177DEFINE_ENUM(SortType, ENUM_LIST_SORTTYPE)
178AS_STRING_DEC(SortType, ENUM_LIST_SORTTYPE)
179FROM_STRING_DEC(SortType, ENUM_LIST_SORTTYPE)
180
181
184GType gnc_split_reg_get_type(void);
185
193GtkWidget* gnc_split_reg_new( GNCLedgerDisplay *ld,
194 GtkWindow *parent,
195 gint numberOfLines,
196 gboolean read_only );
197
201GnucashRegister *gnc_split_reg_get_register( GNCSplitReg *gsr );
202
206GtkWidget *gsr_create_summary_bar( GNCSplitReg *gsr );
207
212SortType gnc_split_reg_get_sort_type( GNCSplitReg *gsr );
213void gnc_split_reg_sort (GNCSplitReg *gsr, SortType t, ForceSort fs, Refresh ref);
214
218void gnc_split_reg_set_sort_reversed(GNCSplitReg *gsr,
219 gboolean rev, Refresh ref);
220
224void gnc_split_reg_change_style (GNCSplitReg *gsr,
225 SplitRegisterStyle style, gboolean refresh);
226
230GtkWidget *gnc_split_reg_get_summarybar( GNCSplitReg *gsr );
231
236void gnc_split_reg_set_split_state( GNCSplitReg *gsr, gboolean split );
237void gnc_split_reg_set_double_line( GNCSplitReg *gsr, gboolean doubleLine );
238
239void gnc_split_reg_raise( GNCSplitReg *gsr );
240
246gboolean gnc_split_reg_get_read_only( GNCSplitReg *gsr );
247
248/*
249 * Function to jump to various places in the register
250 */
251void gnc_split_reg_jump_to_blank (GNCSplitReg *gsr);
252void gnc_split_reg_jump_to_split(GNCSplitReg *gsr, Split *split);
253void gnc_split_reg_jump_to_split_amount(GNCSplitReg *gsr, Split *split);
254
264gboolean gnc_split_reg_clear_filter_for_split (GNCSplitReg *gsr, Split *split);
265
269void gnc_split_reg_focus_on_sheet (GNCSplitReg *gsr);
270void gnc_split_reg_set_sheet_focus (GNCSplitReg *gsr, gboolean has_focus);
271
272/*
273 * Create a transaction entry with given amount and date. One account is
274 * specified, the other is undefined i.e. it defaults to orphan account.
275 * Jump to the transaction entry in the register.
276 * The purpose of this function to create an adjustment entry from the reconcile
277 * window.
278 */
279void gnc_split_reg_balancing_entry (GNCSplitReg *gsr, Account *account,
280 time64 statement_date, gnc_numeric balancing_amount);
281
286void gsr_default_doclink_handler (GNCSplitReg *gsr);
287
292void gsr_default_doclink_open_handler (GNCSplitReg *gsr);
293
298void gsr_default_doclink_remove_handler (GNCSplitReg *gsr);
299
300void gnc_split_reg_enter( GNCSplitReg *gsr, gboolean next_transaction );
301void gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data );
302void gsr_default_cut_txn_handler( GNCSplitReg *gsr, gpointer data );
303void gsr_default_reinit_handler( GNCSplitReg *gsr, gpointer data );
304void gsr_default_expand_handler( GNCSplitReg *gsr, gpointer data );
305void gsr_default_schedule_handler( GNCSplitReg *gsr, gpointer data );
306
313gchar *gsr_get_register_state_section (GNCSplitReg *gsr);
314
315void gnc_split_reg_set_moved_cb( GNCSplitReg *gsr, GFunc cb, gpointer cb_data );
316
317#ifdef __cplusplus
318}
319#endif
320
321#endif /* GNC_SPLIT_REG_H */
Public declarations for GncLedgerDisplay class.
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition gnc-date.h:87
#define ENTER(format, args...)
Print a function entry debugging message.
Definition qoflog.h:272
SplitRegisterStyle
Register styles.
STRUCTS.
GNCLedgerDisplay * ledger
The current ledger display.
GnucashRegister * reg
The actual gnucash register widget.