GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 <[email protected]> *
5  * Copyright (C) 1998 Rob Browning <[email protected]> *
6  * Copyright (C) 1999-2000 Dave Peticolas <[email protected]> *
7  * Copyright (C) 2001 Gnumatic, Inc. *
8  * Copyright (C) 2002,2006 Joshua Sled <[email protected]> *
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 [email protected] *
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-sheet.h"
34 
35 #define GNC_SPLIT_REG(obj) G_TYPE_CHECK_INSTANCE_CAST( obj, gnc_split_reg_get_type(), GNCSplitReg )
36 #define GNC_SPLIT_REG_CLASS(klass) G_TYPE_CHECK_CLASS_CAST( klass, gnc_split_reg_get_type(), GNCSplitRegClass )
37 #define IS_GNC_SPLIT_REG(obj) G_TYPE_CHECK_INSTANCE_TYPE( obj, gnc_split_reg_get_type() )
38 
39 typedef struct _GNCSplitReg GNCSplitReg;
40 typedef struct _GNCSplitRegClass GNCSplitRegClass;
41 
43 {
44  /* The "parent" widget. */
45  GtkVBox vbox;
46 
47  /* The containing window. */
48  GtkWidget *window;
49  gint width;
50  gint height;
51 
52  GtkWidget *toolbar;
53  GtkWidget *summarybar;
54 
55  GtkWidget *popup_menu;
56 
57  GtkWidget *edit_menu;
58  GtkWidget *view_menu;
59  GtkWidget *style_submenu;
60  GtkWidget *sort_submenu;
61  GtkWidget *action_menu;
62 
63  GtkWidget * double_line_check;
64 
65  GtkWidget *split_button;
66  GtkWidget *split_menu_check;
67  GtkWidget *split_popup_check;
68 
69  /* Summary Bar Labels */
70  GtkWidget *balance_label;
71  GtkWidget *cleared_label;
72  GtkWidget *reconciled_label;
73  GtkWidget *future_label;
74  GtkWidget *projectedminimum_label;
75  GtkWidget *shares_label;
76  GtkWidget *value_label;
77 
82 
83  gint numRows;
84 
85  guint sort_type;
86 
87  gboolean read_only;
88 };
89 
91 {
92  GtkVBoxClass parent_class;
93 
94  /* Signal defaults */
95  void (*enter_ent_cb) ( GNCSplitReg *w, gpointer user_data );
96  void (*cancel_ent_cb) ( GNCSplitReg *w, gpointer user_data );
97  void (*delete_ent_cb) ( GNCSplitReg *w, gpointer user_data );
98  void (*reinit_ent_cb) ( GNCSplitReg *w, gpointer user_data );
99  void (*dup_ent_cb) ( GNCSplitReg *w, gpointer user_data );
100  void (*schedule_ent_cb) ( GNCSplitReg *w, gpointer user_data );
101  void (*expand_ent_cb) ( GNCSplitReg *w, gpointer user_data );
102  void (*blank_cb) ( GNCSplitReg *w, gpointer user_data );
103  void (*jump_cb) ( GNCSplitReg *w, gpointer user_data );
104  void (*cut_cb) ( GNCSplitReg *w, gpointer user_data );
105  void (*cut_txn_cb) ( GNCSplitReg *w, gpointer user_data );
106  void (*copy_cb) ( GNCSplitReg *w, gpointer user_data );
107  void (*copy_txn_cb) ( GNCSplitReg *w, gpointer user_data );
108  void (*paste_cb) ( GNCSplitReg *w, gpointer user_data );
109  void (*paste_txn_cb) ( GNCSplitReg *w, gpointer user_data );
110  void (*void_txn_cb) ( GNCSplitReg *w, gpointer user_data );
111  void (*unvoid_txn_cb) ( GNCSplitReg *w, gpointer user_data );
112  void (*reverse_txn_cb) ( GNCSplitReg *w, gpointer user_data );
113  void (*help_changed_cb) ( GNCSplitReg *w, gpointer user_data );
114  void (*include_date_cb) ( GNCSplitReg *w, time64 date, gpointer user_data );
115 };
116 /* Something somewhere sets these to silly values and causes problems */
117 #undef DELETE
118 #undef DUPLICATE
119 typedef enum
120 {
121  ENTER,
122  CANCEL,
123  DELETE,
124  REINIT,
125  DUPLICATE,
126  SCHEDULE,
127  SPLIT,
128  BLANK,
129  JUMP,
130  CUT,
131  CUT_TXN,
132  COPY,
133  COPY_TXN,
134  PASTE,
135  PASTE_TXN,
136  SORT_ORDER_SUBMENU,
137  STYLE_SUBMENU,
138 } GNC_SPLIT_REG_ITEM;
139 
140 /* Easy way to pass the sort-type
141  * Note that this is STUPID -- we should be using parameter lists,
142  * but this provides a simple case statement internally. This should
143  * probably not actually be exposed in the external interface....
144  */
145 #define ENUM_LIST_SORTTYPE(_) \
146  _(BY_NONE,) \
147  _(BY_STANDARD,) \
148  _(BY_DATE,) \
149  _(BY_DATE_ENTERED,) \
150  _(BY_DATE_RECONCILED,) \
151  _(BY_NUM,) \
152  _(BY_AMOUNT,) \
153  _(BY_MEMO,) \
154  _(BY_DESC,) \
155  _(BY_ACTION,) \
156  _(BY_NOTES,)
157 
158 DEFINE_ENUM(SortType, ENUM_LIST_SORTTYPE)
159 AS_STRING_DEC(SortType, ENUM_LIST_SORTTYPE)
160 FROM_STRING_DEC(SortType, ENUM_LIST_SORTTYPE)
161 
165 GType gnc_split_reg_get_type(void);
166 
174 GtkWidget* gnc_split_reg_new( GNCLedgerDisplay *ld,
175  GtkWindow *parent,
176  gint numberOfLines,
177  gboolean read_only );
178 
182 GnucashRegister *gnc_split_reg_get_register( GNCSplitReg *gsr );
183 
187 GtkWidget *gsr_create_summary_bar( GNCSplitReg *gsr );
188 
193 SortType gnc_split_reg_get_sort_type( GNCSplitReg *gsr );
194 void gnc_split_reg_set_sort_type( GNCSplitReg *gsr, SortType t );
195 void gnc_split_reg_set_sort_type_force( GNCSplitReg *gsr, SortType t, gboolean force);
196 
200 void gnc_split_reg_set_sort_reversed(GNCSplitReg *gsr, gboolean rev);
201 
202 
206 void gnc_split_reg_change_style (GNCSplitReg *gsr, SplitRegisterStyle style);
207 
211 GtkWidget *gnc_split_reg_get_summarybar( GNCSplitReg *gsr );
212 
217 void gnc_split_reg_set_split_state( GNCSplitReg *gsr, gboolean split );
218 void gnc_split_reg_set_double_line( GNCSplitReg *gsr, gboolean doubleLine );
219 
220 void gnc_split_reg_raise( GNCSplitReg *gsr );
221 
227 gboolean gnc_split_reg_get_read_only( GNCSplitReg *gsr );
228 
229 /*
230  * Function to jump to various places in the register
231  */
232 void gnc_split_reg_jump_to_blank (GNCSplitReg *gsr);
233 void gnc_split_reg_jump_to_split(GNCSplitReg *gsr, Split *split);
234 void gnc_split_reg_jump_to_split_amount(GNCSplitReg *gsr, Split *split);
235 
236 /*
237  * Create a transaction entry with given amount and date. One account is
238  * specified, the other is undefined i.e. it defaults to orphan account.
239  * Jump to the transaction entry in the register.
240  * The purpose of this function to create an adjustment entry from the reconcile
241  * window.
242  */
243 void gnc_split_reg_balancing_entry (GNCSplitReg *gsr, Account *account,
244  time64 statement_date, gnc_numeric balancing_amount);
245 
246 void gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data );
247 void gsr_default_associate_handler_file( GNCSplitReg *gsr, gpointer data );
248 void gsr_default_associate_handler_location( GNCSplitReg *gsr, gpointer data );
249 void gsr_default_execassociated_handler( GNCSplitReg *gsr, gpointer data );
250 void gnc_split_reg_enter( GNCSplitReg *gsr, gboolean next_transaction );
251 void gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data );
252 void gsr_default_reinit_handler( GNCSplitReg *gsr, gpointer data );
253 void gsr_default_expand_handler( GNCSplitReg *gsr, gpointer data );
254 void gsr_default_schedule_handler( GNCSplitReg *gsr, gpointer data );
255 
256 void gnc_split_reg_set_moved_cb( GNCSplitReg *gsr, GFunc cb, gpointer cb_data );
257 
258 #endif /* GNC_SPLIT_REG_H */
#define ENTER(format, args...)
Definition: qoflog.h:261
GnucashRegister * reg
Definition: gnc-split-reg.h:81
Definition: SplitP.h:71
GNCLedgerDisplay * ledger
Definition: gnc-split-reg.h:79
gint64 time64
Definition: gnc-date.h:83
SplitRegisterStyle