GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gnc-tree-view-split-reg.h
1 /********************************************************************\
2  * gnc-tree-view-split-reg.h -- GtkTreeView implementation to *
3  * display registers in a GtkTreeView. *
4  * *
5  * Copyright (C) 2006-2007 Chris Shoemaker <[email protected]> *
6  * Copyright (C) 2012 Robert Fewell *
7  * *
8  * This program is free software; you can redistribute it and/or *
9  * modify it under the terms of the GNU General Public License as *
10  * published by the Free Software Foundation; either version 2 of *
11  * the License, or (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License*
19  * along with this program; if not, contact: *
20  * *
21  * Free Software Foundation Voice: +1-617-542-5942 *
22  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
23  * Boston, MA 02110-1301, USA [email protected] *
24  * *
25 \********************************************************************/
26 
27 
28 #ifndef __GNC_TREE_VIEW_SPLIT_REG_H
29 #define __GNC_TREE_VIEW_SPLIT_REG_H
30 
31 #include <gtk/gtk.h>
32 #include "gnc-tree-view.h"
33 
34 #include "gnc-tree-model-split-reg.h"
35 #include "gnc-ui-util.h"
36 
37 G_BEGIN_DECLS
38 
39 #define GNC_TYPE_TREE_VIEW_SPLIT_REG (gnc_tree_view_split_reg_get_type ())
40 #define GNC_TREE_VIEW_SPLIT_REG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_SPLIT_REG, GncTreeViewSplitReg))
41 #define GNC_TREE_VIEW_SPLIT_REG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_SPLIT_REG, GncTreeViewSplitRegClass))
42 #define GNC_IS_TREE_VIEW_SPLIT_REG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_SPLIT_REG))
43 #define GNC_IS_TREE_VIEW_SPLIT_REG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_SPLIT_REG))
44 #define GNC_TREE_VIEW_SPLIT_REG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_SPLIT_REG, GncTreeViewSplitRegClass))
45 
46 /* typedefs & structures */
48 
49 typedef struct
50 {
51  GncTreeView gnc_tree_view;
53  int stamp;
54 
55  GtkWidget *window; // Parent Window.
56  GFunc uiupdate_cb; // Used for page gui update
57  gpointer uiupdate_cb_data; // Used for page gui update
58 
59  gchar *help_text; // This is the help text to be displayed.
60  gboolean reg_closing; // This is set when closing the register.
61  gboolean change_allowed; // This is set when we allow the reconciled split to change.
62  gboolean editing_now; // This is set while editing of a cell.
63  gboolean show_extra_dates; // Show the entered date below the posted date and reconciled date on split row
64 
65 
67 
68 typedef struct
69 {
70  GncTreeViewClass gnc_tree_view;
71 
72  /* This signal is emitted when we update the view */
73  void (*update_signal) (GncTreeViewSplitReg *view, gpointer user_data);
74 
75  /* This signal is emitted when we update the help text */
76  void (*help_signal) (GncTreeViewSplitReg *view, gpointer user_data);
77 
79 
80 typedef enum {
81  TOP, //0
82  TRANS1, //1
83  TRANS2, //2
84  SPLIT3, //3
85 }RowDepth;
86 
87 typedef enum {
88  COL_END_OF_LIST = -1,
89  COL_CONTROL, //0 TreeView Control columns
90  COL_DATE, //1
91  COL_DUEDATE, //2
92  COL_NUMACT, //3
93  COL_DESCNOTES, //4
94  COL_TRANSFERVOID, //5
95  COL_RECN, //6
96  COL_TYPE, //7
97  COL_VALUE, //8
98  COL_AMOUNT, //9
99  COL_AMTVAL, //10
100  COL_RATE, //11
101  COL_PRICE, //12
102  COL_DEBIT, //13
103  COL_CREDIT, //14
104  COL_BALANCE, //15
105  COL_STATUS, //16
106  COL_COMM, //17
107 } ViewCol;
108 
109 /* Standard g_object type */
110 GType gnc_tree_view_split_reg_get_type (void);
111 
112 GncTreeViewSplitReg *gnc_tree_view_split_reg_new_with_model (GncTreeModelSplitReg *model);
113 
114 void gnc_tree_view_split_reg_block_selection (GncTreeViewSplitReg *view, gboolean block);
115 
116 void gnc_tree_view_split_reg_default_selection (GncTreeViewSplitReg *view);
117 
118 gboolean gnc_tree_view_split_reg_set_format (GncTreeViewSplitReg *view);
119 
120 void gnc_tree_view_split_reg_set_read_only (GncTreeViewSplitReg *view, gboolean read_only);
121 
122 void gnc_tree_view_split_reg_set_dirty_trans (GncTreeViewSplitReg *view, Transaction *trans);
123 
124 Transaction * gnc_tree_view_split_reg_get_current_trans (GncTreeViewSplitReg *view);
125 
126 Split * gnc_tree_view_split_reg_get_current_split (GncTreeViewSplitReg *view);
127 
128 Transaction * gnc_tree_view_split_reg_get_dirty_trans (GncTreeViewSplitReg *view);
129 
130 GtkTreePath * gnc_tree_view_split_reg_get_current_path (GncTreeViewSplitReg *view);
131 
132 void gnc_tree_view_split_reg_set_current_path (GncTreeViewSplitReg *view, GtkTreePath *mpath);
133 
134 RowDepth gnc_tree_view_reg_get_selected_row_depth (GncTreeViewSplitReg *view);
135 
136 void gnc_tree_view_split_reg_set_uiupdate_cb (GncTreeViewSplitReg *view, GFunc cb, gpointer cb_data);
137 
138 gboolean gnc_tree_view_split_reg_call_uiupdate_cb(GncTreeViewSplitReg *view);
139 
140 void gnc_tree_view_split_reg_refresh_from_prefs (GncTreeViewSplitReg *view);
141 
142 GtkWidget * gnc_tree_view_split_reg_get_parent (GncTreeViewSplitReg *view);
143 
144 gboolean gnc_tree_view_split_reg_trans_expanded (GncTreeViewSplitReg *view, Transaction *trans);
145 
146 void gnc_tree_view_split_reg_expand_trans (GncTreeViewSplitReg *view, Transaction *trans);
147 
148 void gnc_tree_view_split_reg_collapse_trans (GncTreeViewSplitReg *view, Transaction *trans);
149 
150 const char * gnc_tree_view_split_reg_get_credit_debit_string (GncTreeViewSplitReg *view, gboolean credit);
151 
152 gnc_commodity * gnc_tree_view_split_reg_get_reg_commodity (GncTreeViewSplitReg *view);
153 
154 /*************************************************************************************/
155 /* Get sort model path from the model path */
156 GtkTreePath * gnc_tree_view_split_reg_get_sort_path_from_model_path (GncTreeViewSplitReg *view, GtkTreePath *mpath);
157 
158 /* Get model path from the sort model path */
159 GtkTreePath * gnc_tree_view_split_reg_get_model_path_from_sort_path (GncTreeViewSplitReg *view, GtkTreePath *spath);
160 
161 /* Get model from the view */
162 GncTreeModelSplitReg * gnc_tree_view_split_reg_get_model_from_view (GncTreeViewSplitReg *view);
163 
164 /* Scroll the view to the current transaction */
165 gboolean gnc_tree_view_split_reg_scroll_to_cell (GncTreeViewSplitReg *view);
166 
167 /* Scroll the view to the blank split */
168 gboolean gnc_tree_view_split_reg_scroll_to_bsplit (GncTreeViewSplitReg *view);
169 
170 /*************************************************************************************/
171 
172 void gnc_tree_view_split_reg_delete_current_split (GncTreeViewSplitReg *view);
173 
174 void gnc_tree_view_split_reg_delete_current_trans (GncTreeViewSplitReg *view);
175 
176 void gnc_tree_view_split_reg_reinit_trans (GncTreeViewSplitReg *view);
177 
178 gboolean gnc_tree_view_split_reg_enter (GncTreeViewSplitReg *view);
179 
180 void gnc_tree_view_split_reg_cancel_edit (GncTreeViewSplitReg *view, gboolean reg_closing);
181 
182 void gnc_tree_view_split_reg_finish_edit (GncTreeViewSplitReg *view);
183 
184 
185 G_END_DECLS
186 
187 #endif /* __GNC_TREE_VIEW_SPLIT_REG_H */
utility functions for the GnuCash UI
common utilities for manipulating a GtkTreeView within gnucash
Definition: SplitP.h:71