1 /********************************************************************\ 2 * gnc-split-reg2.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 * Copyright (C) 2012 Robert Fewell * 10 * * 11 * This program is free software; you can redistribute it and/or * 12 * modify it under the terms of the GNU General Public License as * 13 * published by the Free Software Foundation; either version 2 of * 14 * the License, or (at your option) any later version. * 15 * * 16 * This program is distributed in the hope that it will be useful, * 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 * GNU General Public License for more details. * 20 * * 21 * You should have received a copy of the GNU General Public License* 22 * along with this program; if not, contact: * 23 * * 24 * Free Software Foundation Voice: +1-617-542-5942 * 25 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 26 * Boston, MA 02110-1301, USA gnu@gnu.org * 27 \********************************************************************/ 28 29 30 #ifndef GNC_SPLIT_REG2_H 31 #define GNC_SPLIT_REG2_H 32 33 #include "gnc-ledger-display2.h" 34 #include "gnc-split-reg.h" 35 #include "gnc-tree-view-split-reg.h" 36 /** @ingroup Register 37 * @addtogroup Register2 38 * @{ 39 */ 40 /** @file gnc-split-reg2.h 41 */ 42 #define GNC_SPLIT_REG2(obj) G_TYPE_CHECK_INSTANCE_CAST( obj, gnc_split_reg2_get_type(), GNCSplitReg2 ) 43 #define GNC_SPLIT_REG2_CLASS(klass) G_TYPE_CHECK_CLASS_CAST( klass, gnc_split_reg2_get_type(), GNCSplitReg2Class ) 44 #define IS_GNC_SPLIT_REG2(obj) G_TYPE_CHECK_INSTANCE_TYPE( obj, gnc_split_reg2_get_type() ) 45 46 typedef struct _GNCSplitReg2 GNCSplitReg2; 47 typedef struct _GNCSplitReg2Class GNCSplitReg2Class; 48 49 struct _GNCSplitReg2 50 { 51 /* The "parent" widget. */ 52 GtkBox vbox; 53 54 /* The containing window. */ 55 GtkWidget *window; 56 GtkWidget *scroll_bar; 57 GtkAdjustment *scroll_adj; 58 59 GtkWidget *toolbar; 60 GtkWidget *summarybar; 61 62 /* Summary Bar Labels */ 63 GtkWidget *balance_label; 64 GtkWidget *cleared_label; 65 GtkWidget *reconciled_label; 66 GtkWidget *future_label; 67 GtkWidget *projectedminimum_label; 68 GtkWidget *shares_label; 69 GtkWidget *value_label; 70 71 /** The current ledger display. **/ 72 GNCLedgerDisplay2 *ledger; 73 74 gint numRows; 75 76 gboolean read_only; 77 }; 78 79 struct _GNCSplitReg2Class 80 { 81 GtkBoxClass parent_class; 82 83 /* Signal defaults */ 84 void (*help_changed) (GNCSplitReg2 *w, gpointer user_data); 85 }; 86 87 /*FIXME Note sure about this == Coming from original gnc-split-reg.h */ 88 typedef GNC_SPLIT_REG_ITEM GNC_SPLIT_REG2_ITEM; 89 90 /** 91 * GTK-related; gets an identifier for the class of GNCSplitRegs. 92 **/ 93 GType gnc_split_reg2_get_type (void); 94 95 /** 96 * Creates and returns a GNCSplitReg. 97 * @param ld The GNCLedgerDisplay to use for display. 98 * @param parent The containing window. 99 * @param numberOfLines The initial number of lines for the register. 100 * @param read_only If the contained register should be setup read-only. 101 **/ 102 GtkWidget* gnc_split_reg2_new (GNCLedgerDisplay2 *ld, 103 GtkWindow *parent, 104 gint numberOfLines, 105 gboolean read_only); 106 107 /** 108 * Returns the GncTreeView Split Register in effect for this GNCSplitReg. 109 **/ 110 GncTreeViewSplitReg *gnc_split_reg2_get_register (GNCSplitReg2 *gsr); 111 112 /** 113 * Create and returns a summarybar for this GNCSplitReg. 114 **/ 115 GtkWidget *gnc_split_reg2_create_summary_bar (GNCSplitReg2 *gsr); 116 117 /** 118 * Gets/sets the style of the GNCSplitReg. 119 **/ 120 void gnc_split_reg2_change_style (GNCSplitReg2 *gsr, SplitRegisterStyle2 style); 121 122 /** 123 * Can return NULL if the indicated subwidget was not created. 124 **/ 125 GtkWidget *gnc_split_reg2_get_summarybar (GNCSplitReg2 *gsr); 126 127 /** 128 * Jump to split. 129 **/ 130 void gnc_split_reg2_jump_to_split (GNCSplitReg2 *gsr, Split *split); 131 132 /** 133 * Move the cursor to the split in the non-blank amount column. 134 **/ 135 void gnc_split_reg2_jump_to_split_amount (GNCSplitReg2 *gsr, Split *split); 136 137 138 /** 139 * Raise an existing register window to the front. 140 **/ 141 void gnc_split_reg2_raise (GNCSplitReg2 *gsr); 142 143 /** 144 * Callers can use this to determine if they need to reflect some "read-only" 145 * status in the window which contains the GNCSplitReg. 146 * @return TRUE if the register is read-only, FALSE if not. 147 **/ 148 gboolean gnc_split_reg2_get_read_only (GNCSplitReg2 *gsr); 149 150 /* 151 * Create a transaction entry with given amount and date. One account is 152 * specified, the other is undefined i.e. it defaults to orphan account. 153 * Jump to the transaction entry in the register. 154 * The purpose of this function to create an adjustment entry from the reconcile 155 * window. 156 */ 157 void gnc_split_reg2_balancing_entry (GNCSplitReg2 *gsr, Account *account, 158 time64 statement_date, gnc_numeric balancing_amount); 159 160 161 void gnc_split_reg2_set_moved_cb (GNCSplitReg2 *gsr, GFunc cb, gpointer cb_data); 162 /** @} */ 163 #endif /* GNC_SPLIT_REG2_H */ 164