GnuCash  4.11-148-gc20d717b33+
gnc-tree-view-split-reg.h
Go to the documentation of this file.
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 <c.shoemaker@cox.net> *
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 gnu@gnu.org *
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 
35 #include "gnc-ui-util.h"
36 
37 G_BEGIN_DECLS
44 #define GNC_TYPE_TREE_VIEW_SPLIT_REG (gnc_tree_view_split_reg_get_type ())
45 #define GNC_TREE_VIEW_SPLIT_REG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_SPLIT_REG, GncTreeViewSplitReg))
46 #define GNC_TREE_VIEW_SPLIT_REG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_SPLIT_REG, GncTreeViewSplitRegClass))
47 #define GNC_IS_TREE_VIEW_SPLIT_REG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_SPLIT_REG))
48 #define GNC_IS_TREE_VIEW_SPLIT_REG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_SPLIT_REG))
49 #define GNC_TREE_VIEW_SPLIT_REG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_SPLIT_REG, GncTreeViewSplitRegClass))
50 
51 /* typedefs & structures */
53 
54 typedef struct
55 {
56  GncTreeView gnc_tree_view;
58  int stamp;
59 
60  GtkWidget *window; // Parent Window.
61  GFunc uiupdate_cb; // Used for page gui update
62  gpointer uiupdate_cb_data; // Used for page gui update
63 
64  gchar *help_text; // This is the help text to be displayed.
65  gboolean reg_closing; // This is set when closing the register.
66  gboolean change_allowed; // This is set when we allow the reconciled split to change.
67  gboolean editing_now; // This is set while editing of a cell.
68  gboolean show_extra_dates; // Show the entered date below the posted date and reconciled date on split row
69 
70 
72 
73 typedef struct
74 {
75  GncTreeViewClass gnc_tree_view;
76 
77  /* This signal is emitted when we update the view */
78  void (*update_signal) (GncTreeViewSplitReg *view, gpointer user_data);
79 
80  /* This signal is emitted when we update the help text */
81  void (*help_signal) (GncTreeViewSplitReg *view, gpointer user_data);
82 
84 
85 typedef enum {
86  TOP, //0
87  TRANS1, //1
88  TRANS2, //2
89  SPLIT3, //3
90 }RowDepth;
91 
92 typedef enum {
93  COL_END_OF_LIST = -1,
94  COL_CONTROL, //0 TreeView Control columns
95  COL_DATE, //1
96  COL_DUEDATE, //2
97  COL_NUMACT, //3
98  COL_DESCNOTES, //4
99  COL_TRANSFERVOID, //5
100  COL_RECN, //6
101  COL_TYPE, //7
102  COL_VALUE, //8
103  COL_AMOUNT, //9
104  COL_AMTVAL, //10
105  COL_RATE, //11
106  COL_PRICE, //12
107  COL_DEBIT, //13
108  COL_CREDIT, //14
109  COL_BALANCE, //15
110  COL_STATUS, //16
111  COL_COMM, //17
112 } ViewCol;
113 
114 /* Standard g_object type */
115 GType gnc_tree_view_split_reg_get_type (void);
116 
117 GncTreeViewSplitReg *gnc_tree_view_split_reg_new_with_model (GncTreeModelSplitReg *model);
118 
119 void gnc_tree_view_split_reg_block_selection (GncTreeViewSplitReg *view, gboolean block);
120 
121 void gnc_tree_view_split_reg_default_selection (GncTreeViewSplitReg *view);
122 
123 gboolean gnc_tree_view_split_reg_set_format (GncTreeViewSplitReg *view);
124 
125 void gnc_tree_view_split_reg_set_read_only (GncTreeViewSplitReg *view, gboolean read_only);
126 
127 void gnc_tree_view_split_reg_set_dirty_trans (GncTreeViewSplitReg *view, Transaction *trans);
128 
129 Transaction * gnc_tree_view_split_reg_get_current_trans (GncTreeViewSplitReg *view);
130 
131 Split * gnc_tree_view_split_reg_get_current_split (GncTreeViewSplitReg *view);
132 
133 Transaction * gnc_tree_view_split_reg_get_dirty_trans (GncTreeViewSplitReg *view);
134 
135 GtkTreePath * gnc_tree_view_split_reg_get_current_path (GncTreeViewSplitReg *view);
136 
137 void gnc_tree_view_split_reg_set_current_path (GncTreeViewSplitReg *view, GtkTreePath *mpath);
138 
139 RowDepth gnc_tree_view_reg_get_selected_row_depth (GncTreeViewSplitReg *view);
140 
141 void gnc_tree_view_split_reg_set_uiupdate_cb (GncTreeViewSplitReg *view, GFunc cb, gpointer cb_data);
142 
144 
145 void gnc_tree_view_split_reg_refresh_from_prefs (GncTreeViewSplitReg *view);
146 
147 GtkWidget * gnc_tree_view_split_reg_get_parent (GncTreeViewSplitReg *view);
148 
149 gboolean gnc_tree_view_split_reg_trans_expanded (GncTreeViewSplitReg *view, Transaction *trans);
150 
151 void gnc_tree_view_split_reg_expand_trans (GncTreeViewSplitReg *view, Transaction *trans);
152 
153 void gnc_tree_view_split_reg_collapse_trans (GncTreeViewSplitReg *view, Transaction *trans);
154 
155 const char * gnc_tree_view_split_reg_get_credit_debit_string (GncTreeViewSplitReg *view, gboolean credit);
156 
157 gnc_commodity * gnc_tree_view_split_reg_get_reg_commodity (GncTreeViewSplitReg *view);
158 
159 /*************************************************************************************/
160 /* Get sort model path from the model path */
161 GtkTreePath * gnc_tree_view_split_reg_get_sort_path_from_model_path (GncTreeViewSplitReg *view, GtkTreePath *mpath);
162 
163 /* Get model path from the sort model path */
164 GtkTreePath * gnc_tree_view_split_reg_get_model_path_from_sort_path (GncTreeViewSplitReg *view, GtkTreePath *spath);
165 
166 /* Get model from the view */
167 GncTreeModelSplitReg * gnc_tree_view_split_reg_get_model_from_view (GncTreeViewSplitReg *view);
168 
169 /* Scroll the view to the current transaction */
170 gboolean gnc_tree_view_split_reg_scroll_to_cell (GncTreeViewSplitReg *view);
171 
172 /* Scroll the view to the blank split */
173 gboolean gnc_tree_view_split_reg_scroll_to_bsplit (GncTreeViewSplitReg *view);
174 
175 /*************************************************************************************/
176 
177 void gnc_tree_view_split_reg_delete_current_split (GncTreeViewSplitReg *view);
178 
179 void gnc_tree_view_split_reg_delete_current_trans (GncTreeViewSplitReg *view);
180 
181 void gnc_tree_view_split_reg_reinit_trans (GncTreeViewSplitReg *view);
182 
183 gboolean gnc_tree_view_split_reg_enter (GncTreeViewSplitReg *view);
184 
185 void gnc_tree_view_split_reg_cancel_edit (GncTreeViewSplitReg *view, gboolean reg_closing);
186 
187 void gnc_tree_view_split_reg_finish_edit (GncTreeViewSplitReg *view);
188 
190 G_END_DECLS
191 
192 #endif /* __GNC_TREE_VIEW_SPLIT_REG_H */
gboolean gnc_tree_view_split_reg_call_uiupdate_cb(GncTreeViewSplitReg *view)
Call the moved_cb callback that is used to update the page ui, if it is set.
utility functions for the GnuCash UI
common utilities for manipulating a GtkTreeView within gnucash
The instance data structure for an account tree model.