/usr/include/gnucash/gnc-tree-model-split-reg.h is in gnucash-common 1:2.6.12-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | /********************************************************************\
* gnc-tree-model-split-reg.h -- GtkTreeView implementation to *
* display registers in a GtkTreeView. *
* *
* Copyright (C) 2006-2007 Chris Shoemaker <c.shoemaker@cox.net> *
* Copyright (C) 2012 Robert Fewell *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
* *
\********************************************************************/
#ifndef __GNC_TREE_MODEL_SPLIT_REG_H
#define __GNC_TREE_MODEL_SPLIT_REG_H
#include <gtk/gtk.h>
#include "gnc-tree-model.h"
#include "Query.h"
G_BEGIN_DECLS
/** @ingroup Register
* @addtogroup Register2
* @{
*/
/** @file gnc-tree-model-split-reg.h
*/
/* type macros */
#define GNC_TYPE_TREE_MODEL_SPLIT_REG (gnc_tree_model_split_reg_get_type ())
#define GNC_TREE_MODEL_SPLIT_REG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_SPLIT_REG, GncTreeModelSplitReg))
#define GNC_TREE_MODEL_SPLIT_REG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL_SPLIT_REG, GncTreeModelSplitRegClass))
#define GNC_IS_TREE_MODEL_SPLIT_REG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL_SPLIT_REG))
#define GNC_IS_TREE_MODEL_SPLIT_REG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL_SPLIT_REG))
#define GNC_TREE_MODEL_SPLIT_REG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL_SPLIT_REG, GncTreeModelSplitRegClass))
#define GNC_TREE_MODEL_SPLIT_REG_NAME "GncTreeModelSplitReg"
/* Define the number of transaction to load */
#define NUM_OF_TRANS 30
/** @brief Register types
*
* "registers" are single-account display windows.
* "ledgers" are multiple-account display windows */
typedef enum
{
BANK_REGISTER2, //0
CASH_REGISTER2, //1
ASSET_REGISTER2, //2
CREDIT_REGISTER2, //3
LIABILITY_REGISTER2, //4
INCOME_REGISTER2, //5
EXPENSE_REGISTER2, //6
EQUITY_REGISTER2, //7
STOCK_REGISTER2, //8
CURRENCY_REGISTER2, //9
RECEIVABLE_REGISTER2, //10
PAYABLE_REGISTER2, //11
TRADING_REGISTER2, //12
NUM_SINGLE_REGISTER_TYPES2, //13
GENERAL_LEDGER2 = NUM_SINGLE_REGISTER_TYPES2, //13
INCOME_LEDGER2, //14
PORTFOLIO_LEDGER2, //15
SEARCH_LEDGER2, //16
NUM_REGISTER_TYPES2 //17
} SplitRegisterType2;
/** Register styles */
typedef enum
{
REG2_STYLE_LEDGER, //0
REG2_STYLE_AUTO_LEDGER, //1
REG2_STYLE_JOURNAL //2
} SplitRegisterStyle2;
typedef enum
{
GNC_TREE_MODEL_SPLIT_REG_COL_GUID, //0
GNC_TREE_MODEL_SPLIT_REG_COL_DATE, //1
GNC_TREE_MODEL_SPLIT_REG_COL_DUEDATE, //2
GNC_TREE_MODEL_SPLIT_REG_COL_NUMACT, //3
GNC_TREE_MODEL_SPLIT_REG_COL_DESCNOTES, //4
GNC_TREE_MODEL_SPLIT_REG_COL_TRANSFERVOID, //5
GNC_TREE_MODEL_SPLIT_REG_COL_RECN, //6
GNC_TREE_MODEL_SPLIT_REG_COL_DEBIT, //7
GNC_TREE_MODEL_SPLIT_REG_COL_CREDIT, //8
GNC_TREE_MODEL_SPLIT_REG_COL_LAST_VISIBLE = GNC_TREE_MODEL_SPLIT_REG_COL_CREDIT, //8
/* internal hidden columns */
GNC_TREE_MODEL_SPLIT_REG_COL_RO, //9
GNC_TREE_MODEL_SPLIT_REG_COL_NUM_VIS, //10
GNC_TREE_MODEL_SPLIT_REG_COL_ACT_VIS, //11
GNC_TREE_MODEL_SPLIT_REG_NUM_COLUMNS //12
} GncTreeModelSplitRegColumn;
typedef enum
{
VIEW_HOME, //0
VIEW_UP, //1
VIEW_PGUP, //2
VIEW_GOTO, //3
VIEW_PGDOWN, //4
VIEW_DOWN, //5
VIEW_END, //6
} GncTreeModelSplitRegUpdate;
/* typedefs & structures */
typedef struct GncTreeModelSplitRegPrivate GncTreeModelSplitRegPrivate;
/** The instance data structure for an account tree model. */
typedef struct
{
GncTreeModel gnc_tree_model; /**< The parent object data. */
GncTreeModelSplitRegPrivate *priv;
gint stamp; /**< The state of the model. Any state change increments this number. */
SplitRegisterType2 type; /**<FIXME ? This may be the wrong place for these, may be the view ? */
SplitRegisterStyle2 style; /**<FIXME ? This may be the wrong place for these, may be the view ? */
gboolean use_double_line; /**<FIXME ? As above, whether to use two lines per transaction */
gboolean is_template; /**< Are we using a template */
gint sort_depth; /**< This is the row the sort direction is based on. */
gint sort_col; /**< This is the column the sort direction is based on. */
GtkSortType sort_direction; /**< This is the direction of sort */
gboolean use_accounting_labels; /**< whether to use accounting Labels */
gboolean separator_changed; /**< whether the separator has changed */
gboolean alt_colors_by_txn; /**< whether to use alternative colors by transaction */
gboolean use_theme_colors; /**< whether to use theme colors */
gboolean read_only; /**< register is read only */
Transaction *current_trans; /**< Current transaction */
gint current_row; /**< Current row in treeview */
gint number_of_trans_in_full_tlist; /**< The total number of transactions in full_tlist */
gint position_of_trans_in_full_tlist; /**< The position of current transaction in full_tlist */
}GncTreeModelSplitReg;
/** The class data structure for an account tree model. */
typedef struct
{
GncTreeModelClass gnc_tree_model; /**< The parent object data. */
/* This signal is emitted to refresh the transaction view, the pointer has
the transaction */
void (*refresh_trans) (GncTreeModelSplitReg *model, gpointer item);
/* This signal is emitted to refresh the model */
void (*refresh_view) (GncTreeModelSplitReg *model, gpointer user_data);
/* This signal is emitted to keep scrollbar in sync */
void (*scroll_sync) (GncTreeModelSplitReg *model, gpointer user_data);
/* This signal is emitted to refresh the status bar */
void (*refresh_status_bar) (GncTreeModelSplitReg *model, gpointer user_data);
/* This signal is emitted before a transaction delete, the pointer has
the transaction */
void (*selection_move_delete) (GncTreeModelSplitReg *model, gpointer item);
} GncTreeModelSplitRegClass;
/** Callback function type - Used to get parent window */
typedef GtkWidget *(*SRGetParentCallback2) (gpointer user_data);
/** Get the type of split register tree plugin.
*
* @return A GType.
*/
GType gnc_tree_model_split_reg_get_type (void);
/** Create new model and set options for register. */
GncTreeModelSplitReg *
gnc_tree_model_split_reg_new (SplitRegisterType2 reg_type, SplitRegisterStyle2 style,
gboolean use_double_line, gboolean is_template);
/** Load the model from a slist and set default account for register. */
void gnc_tree_model_split_reg_load (GncTreeModelSplitReg *model, GList * slist, Account *default_account);
/** Sets the template account. */
void gnc_tree_model_split_reg_set_template_account (GncTreeModelSplitReg *model, Account *template_account);
/** Returns the template account. */
Account * gnc_tree_model_split_reg_get_template_account (GncTreeModelSplitReg *model);
/** Return TRUE if this is a template register. */
gboolean gnc_tree_model_split_reg_get_template (GncTreeModelSplitReg *model);
/** Destroy the model. */
void gnc_tree_model_split_reg_destroy (GncTreeModelSplitReg *model);
/** Sets the user data and callback hooks for the register. */
void gnc_tree_model_split_reg_set_data (GncTreeModelSplitReg *model, gpointer user_data,
SRGetParentCallback2 get_parent);
/** Update the query for the register. */
void gnc_tree_model_split_reg_update_query (GncTreeModelSplitReg *model, Query *query);
/** Returns the parent Window of the register. */
GtkWidget * gnc_tree_model_split_reg_get_parent (GncTreeModelSplitReg *model);
/** Set style and type for register. */
void gnc_tree_model_split_reg_config (GncTreeModelSplitReg *model, SplitRegisterType2 newtype,
SplitRegisterStyle2 newstyle, gboolean use_double_line);
/** Return the default account for this register model. */
Account * gnc_tree_model_split_reg_get_anchor (GncTreeModelSplitReg *model);
/** Commit the blank split. */
void gnc_tree_model_split_reg_commit_blank_split (GncTreeModelSplitReg *model);
/** Set display general ledger and show sub accounts. */
void gnc_tree_model_split_reg_set_display (GncTreeModelSplitReg *model, gboolean subacc, gboolean gl);
/** Change transactions in the tlist based on view movement. */
void gnc_tree_model_split_reg_move (GncTreeModelSplitReg *model, GncTreeModelSplitRegUpdate model_update);
/* Sync the vertical scrollbar to position in full_tlist. */
void gnc_tree_model_split_reg_sync_scrollbar (GncTreeModelSplitReg *model);
/** Return the first transaction, opposite to blank transaction in the full list. */
Transaction * gnc_tree_model_split_reg_get_first_trans (GncTreeModelSplitReg *model);
/** Return TRUE if transaction is in the view list. */
gboolean gnc_tree_model_split_reg_trans_is_in_view (GncTreeModelSplitReg *model, Transaction *trans);
/* These are to do with autocompletion */
GtkListStore * gnc_tree_model_split_reg_get_description_list (GncTreeModelSplitReg *model);
GtkListStore * gnc_tree_model_split_reg_get_notes_list (GncTreeModelSplitReg *model);
GtkListStore * gnc_tree_model_split_reg_get_memo_list (GncTreeModelSplitReg *model);
GtkListStore * gnc_tree_model_split_reg_get_action_list (GncTreeModelSplitReg *model);
GtkListStore * gnc_tree_model_split_reg_get_acct_list (GncTreeModelSplitReg *model);
void gnc_tree_model_split_reg_update_num_list (GncTreeModelSplitReg *model);
void gnc_tree_model_split_reg_update_action_list (GncTreeModelSplitReg *model);
void gnc_tree_model_split_reg_update_account_list (GncTreeModelSplitReg *model);
void gnc_tree_model_split_reg_update_completion (GncTreeModelSplitReg *model);
/* Get the split and transaction */
gboolean gnc_tree_model_split_reg_get_split_and_trans (
GncTreeModelSplitReg *model, GtkTreeIter *iter,
gboolean *is_trow1, gboolean *is_trow2, gboolean *is_split,
gboolean *is_blank, Split **split, Transaction **trans);
/* Return FALSE if failure */
gboolean gnc_tree_model_split_reg_set_blank_split_parent (
GncTreeModelSplitReg *model, Transaction *trans, gboolean remove_only);
/* Return the blank split */
Split * gnc_tree_model_split_get_blank_split (GncTreeModelSplitReg *model);
/* Return TRUE if blank_split is on trans */
gboolean gnc_tree_model_split_reg_is_blank_split_parent (GncTreeModelSplitReg *model, Transaction *trans);
/* Return the blank trans */
Transaction * gnc_tree_model_split_get_blank_trans (GncTreeModelSplitReg *model);
/* If 'trans' is NULL, use split's parent. If 'split' is NULL, just
get the transaction iter. */
gboolean gnc_tree_model_split_reg_get_iter_from_trans_and_split (
GncTreeModelSplitReg *model, Transaction *trans, Split *split,
GtkTreeIter *iter1, GtkTreeIter *iter2);
/* Return the row color for the view */
gchar * gnc_tree_model_split_reg_get_row_color (GncTreeModelSplitReg *model, gboolean is_trow1,
gboolean is_trow2, gboolean is_split, gint num);
/* Return the tooltip for transaction at position in full_tlist. */
gchar * gnc_tree_model_split_reg_get_tooltip (GncTreeModelSplitReg *model, gint position);
/* Set the current transaction to that at position in full_tlist */
void gnc_tree_model_split_reg_set_current_trans_by_position (GncTreeModelSplitReg *model, gint position);
/* Return TRUE if this transaction is read only for the view */
gboolean
gnc_tree_model_split_reg_get_read_only (GncTreeModelSplitReg *model, Transaction *trans);
/* Return TRUE if this is a sub account view */
gboolean
gnc_tree_model_split_reg_get_sub_account (GncTreeModelSplitReg *model);
/* Return the tree path, if split and trans are null, last in list returned */
GtkTreePath * gnc_tree_model_split_reg_get_path_to_split_and_trans (
GncTreeModelSplitReg *model, Split *split, Transaction *trans);
/* Returns TRUE if iter is a blank transaction */
gboolean gnc_tree_model_split_reg_is_blank_trans (GncTreeModelSplitReg *model, GtkTreeIter *iter);
/* Return the split for which ancestor is it's parent */
Split * gnc_tree_model_split_reg_trans_get_split_equal_to_ancestor (const Transaction *trans, const Account *ancestor);
/* Dummy Sort function */
gint gnc_tree_model_split_reg_sort_iter_compare_func (GtkTreeModel *tm, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data);
/*****************************************************************************/
/** @} */
G_END_DECLS
#endif /* __GNC_TREE_MODEL_SPLIT_REG_H */
|