|
GnuCash 2.4.99
|
00001 /********************************************************************\ 00002 * gnc-split-reg.h -- A widget for the common register look-n-feel. * 00003 * Copyright (C) 1997 Robin D. Clark * 00004 * Copyright (C) 1997-1998 Linas Vepstas <linas@linas.org> * 00005 * Copyright (C) 1998 Rob Browning <rlb@cs.utexas.edu> * 00006 * Copyright (C) 1999-2000 Dave Peticolas <dave@krondo.com> * 00007 * Copyright (C) 2001 Gnumatic, Inc. * 00008 * Copyright (C) 2002,2006 Joshua Sled <jsled@asynchronous.org> * 00009 * * 00010 * This program is free software; you can redistribute it and/or * 00011 * modify it under the terms of the GNU General Public License as * 00012 * published by the Free Software Foundation; either version 2 of * 00013 * the License, or (at your option) any later version. * 00014 * * 00015 * This program is distributed in the hope that it will be useful, * 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00018 * GNU General Public License for more details. * 00019 * * 00020 * You should have received a copy of the GNU General Public License* 00021 * along with this program; if not, contact: * 00022 * * 00023 * Free Software Foundation Voice: +1-617-542-5942 * 00024 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 00025 * Boston, MA 02110-1301, USA gnu@gnu.org * 00026 \********************************************************************/ 00027 00028 00029 #ifndef GNC_SPLIT_REG_H 00030 #define GNC_SPLIT_REG_H 00031 00032 #include "gnc-ledger-display.h" 00033 #include "gnucash-sheet.h" 00034 00035 #define GNC_SPLIT_REG(obj) GTK_CHECK_CAST( obj, gnc_split_reg_get_type(), GNCSplitReg ) 00036 #define GNC_SPLIT_REG_CLASS(klass) GTK_CHECK_CLASS_CAST( klass, gnc_split_reg_get_type(), GNCSplitRegClass ) 00037 #define IS_GNC_SPLIT_REG(obj) GTK_CHECK_TYPE( obj, gnc_split_reg_get_type() ) 00038 00039 typedef struct _GNCSplitReg GNCSplitReg; 00040 typedef struct _GNCSplitRegClass GNCSplitRegClass; 00041 00042 struct _GNCSplitReg 00043 { 00044 /* The "parent" widget. */ 00045 GtkVBox vbox; 00046 00047 /* The containing window. */ 00048 GtkWidget *window; 00049 gint width; 00050 gint height; 00051 00052 GtkWidget *toolbar; 00053 GtkWidget *summarybar; 00054 00055 GtkWidget *popup_menu; 00056 00057 GtkWidget *edit_menu; 00058 GtkWidget *view_menu; 00059 GtkWidget *style_submenu; 00060 GtkWidget *sort_submenu; 00061 GtkWidget *action_menu; 00062 00063 GtkWidget * double_line_check; 00064 00065 GtkWidget *split_button; 00066 GtkWidget *split_menu_check; 00067 GtkWidget *split_popup_check; 00068 00069 /* Summary Bar Labels */ 00070 GtkWidget *balance_label; 00071 GtkWidget *cleared_label; 00072 GtkWidget *reconciled_label; 00073 GtkWidget *future_label; 00074 GtkWidget *projectedminimum_label; 00075 GtkWidget *shares_label; 00076 GtkWidget *value_label; 00077 00079 GNCLedgerDisplay *ledger; 00081 GnucashRegister *reg; 00082 00083 gint numRows; 00084 00085 guint sort_type; 00086 00087 gboolean read_only; 00088 }; 00089 00090 struct _GNCSplitRegClass 00091 { 00092 GtkVBoxClass parent_class; 00093 00094 /* Signal defaults */ 00095 void (*enter_ent_cb) ( GNCSplitReg *w, gpointer user_data ); 00096 void (*cancel_ent_cb) ( GNCSplitReg *w, gpointer user_data ); 00097 void (*delete_ent_cb) ( GNCSplitReg *w, gpointer user_data ); 00098 void (*reinit_ent_cb) ( GNCSplitReg *w, gpointer user_data ); 00099 void (*dup_ent_cb) ( GNCSplitReg *w, gpointer user_data ); 00100 void (*schedule_ent_cb) ( GNCSplitReg *w, gpointer user_data ); 00101 void (*expand_ent_cb) ( GNCSplitReg *w, gpointer user_data ); 00102 void (*blank_cb) ( GNCSplitReg *w, gpointer user_data ); 00103 void (*jump_cb) ( GNCSplitReg *w, gpointer user_data ); 00104 void (*cut_cb) ( GNCSplitReg *w, gpointer user_data ); 00105 void (*cut_txn_cb) ( GNCSplitReg *w, gpointer user_data ); 00106 void (*copy_cb) ( GNCSplitReg *w, gpointer user_data ); 00107 void (*copy_txn_cb) ( GNCSplitReg *w, gpointer user_data ); 00108 void (*paste_cb) ( GNCSplitReg *w, gpointer user_data ); 00109 void (*paste_txn_cb) ( GNCSplitReg *w, gpointer user_data ); 00110 void (*void_txn_cb) ( GNCSplitReg *w, gpointer user_data ); 00111 void (*unvoid_txn_cb) ( GNCSplitReg *w, gpointer user_data ); 00112 void (*reverse_txn_cb) ( GNCSplitReg *w, gpointer user_data ); 00113 void (*help_changed_cb) ( GNCSplitReg *w, gpointer user_data ); 00114 void (*include_date_cb) ( GNCSplitReg *w, time_t date, gpointer user_data ); 00115 }; 00116 00117 typedef enum 00118 { 00119 ENTER, 00120 CANCEL, 00121 DELETE, 00122 REINIT, 00123 DUPLICATE, 00124 SCHEDULE, 00125 SPLIT, 00126 BLANK, 00127 JUMP, 00128 CUT, 00129 CUT_TXN, 00130 COPY, 00131 COPY_TXN, 00132 PASTE, 00133 PASTE_TXN, 00134 SORT_ORDER_SUBMENU, 00135 STYLE_SUBMENU, 00136 } GNC_SPLIT_REG_ITEM; 00137 00138 /* Easy way to pass the sort-type 00139 * Note that this is STUPID -- we should be using parameter lists, 00140 * but this provides a simple case statement internally. This should 00141 * probably not actually be exposed in the external interface.... 00142 */ 00143 #define ENUM_LIST_SORTTYPE(_) \ 00144 _(BY_NONE,) \ 00145 _(BY_STANDARD,) \ 00146 _(BY_DATE,) \ 00147 _(BY_DATE_ENTERED,) \ 00148 _(BY_DATE_RECONCILED,) \ 00149 _(BY_NUM,) \ 00150 _(BY_AMOUNT,) \ 00151 _(BY_MEMO,) \ 00152 _(BY_DESC,) \ 00153 _(BY_ACTION,) \ 00154 _(BY_NOTES,) 00155 00156 DEFINE_ENUM(SortType, ENUM_LIST_SORTTYPE) 00157 AS_STRING_DEC(SortType, ENUM_LIST_SORTTYPE) 00158 FROM_STRING_DEC(SortType, ENUM_LIST_SORTTYPE) 00159 00163 GType gnc_split_reg_get_type(void); 00164 00172 GtkWidget* gnc_split_reg_new( GNCLedgerDisplay *ld, 00173 GtkWindow *parent, 00174 gint numberOfLines, 00175 gboolean read_only ); 00176 00180 GnucashRegister *gnc_split_reg_get_register( GNCSplitReg *gsr ); 00181 00185 GtkWidget *gsr_create_summary_bar( GNCSplitReg *gsr ); 00186 00190 SortType gnc_split_reg_get_sort_type( GNCSplitReg *gsr ); 00191 void gnc_split_reg_set_sort_type( GNCSplitReg *gsr, SortType t ); 00192 00196 void gnc_split_reg_change_style (GNCSplitReg *gsr, SplitRegisterStyle style); 00197 00201 GtkWidget *gnc_split_reg_get_summarybar( GNCSplitReg *gsr ); 00202 00207 void gnc_split_reg_set_split_state( GNCSplitReg *gsr, gboolean split ); 00208 void gnc_split_reg_set_double_line( GNCSplitReg *gsr, gboolean doubleLine ); 00209 00210 void gnc_split_reg_raise( GNCSplitReg *gsr ); 00211 00217 gboolean gnc_split_reg_get_read_only( GNCSplitReg *gsr ); 00218 00219 /* 00220 * Function to jump to various places in the register 00221 */ 00222 void gnc_split_reg_jump_to_blank (GNCSplitReg *gsr); 00223 void gnc_split_reg_jump_to_split(GNCSplitReg *gsr, Split *split); 00224 void gnc_split_reg_jump_to_split_amount(GNCSplitReg *gsr, Split *split); 00225 00226 /* 00227 * Create a transaction entry with given amount and date. One account is 00228 * specified, the other is undefined i.e. it defaults to orphan account. 00229 * Jump to the transaction entry in the register. 00230 * The purpose of this function to create an adjustment entry from the reconcile 00231 * window. 00232 */ 00233 void gnc_split_reg_balancing_entry (GNCSplitReg *gsr, Account *account, 00234 time_t statement_date, gnc_numeric balancing_amount); 00235 00236 void gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data ); 00237 void gnc_split_reg_enter( GNCSplitReg *gsr, gboolean next_transaction ); 00238 void gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data ); 00239 void gsr_default_reinit_handler( GNCSplitReg *gsr, gpointer data ); 00240 void gsr_default_expand_handler( GNCSplitReg *gsr, gpointer data ); 00241 void gsr_default_schedule_handler( GNCSplitReg *gsr, gpointer data ); 00242 00243 void gnc_split_reg_set_moved_cb( GNCSplitReg *gsr, GFunc cb, gpointer cb_data ); 00244 00245 #endif /* GNC_SPLIT_REG_H */
1.7.4