GnuCash  5.6-150-g038405b370+
Files | Data Structures | Macros | Typedefs | Enumerations | Functions

A "Cell" is an active object which is designed to read a specific kind of user input. More...

Files

file  basiccell.h
 
file  cell-factory.h
 
file  checkboxcell.h
 
file  combocell.h
 
file  datecell.h
 
file  doclinkcell.h
 
file  formulacell.h
 
file  numcell.h
 
file  pricecell.h
 
file  quickfillcell.h
 
file  recncell.h
 

Data Structures

struct  BasicCell
 The BasicCell class provides an abstract base class defining the handling of the editing of a cell of a table. More...
 
struct  CheckboxCell
 The CheckboxCell object implements a cell handler that will toggle between yes and no values when clicked upon by the mouse. More...
 
struct  ComboCell
 The ComboCell object implements a cell handler with a "combination-box" pull-down menu in it. More...
 
struct  CompletionCell
 The CompletionCell object implements a cell handler with a "combination-box" pull-down menu in it. More...
 
struct  DateCell
 The DateCell object implements a date handling cell. More...
 
struct  Doclinkcell
 The Doclinkcell object implements a cell handler that will cycle through a series of single-character values when clicked upon by the mouse and will return a glyph if font can show it. More...
 
struct  FormulaCell
 The FormulaCell is a register-table cell which can contain a formula involving numbers, formula markup and strings denoting either functions or variables. More...
 
struct  NumCell
 The NumCell object implements a number handling cell. More...
 
struct  PriceCell
 The PriceCell object implements a cell handler that stores a single double-precision value, and has the smarts to display it as a price/amount as well as accepting monetary or general numeric input. More...
 
struct  QuickFillCell
 The QuickFillCell implements a text cell with quick-fill capabilities. More...
 
struct  RecnCell
 The RecnCell object implements a cell handler that will cycle through a series of single-character values when clicked upon by the mouse. More...
 

Macros

#define GLYPH_PAPERCLIP   "\360\237\223\216"
 
#define GLYPH_LINK   "\360\237\224\227"
 

Typedefs

typedef BasicCell *(* CellCreateFunc) (void)
 
typedef void(* CellSetValueFunc) (BasicCell *cell, const char *new_value)
 
typedef gboolean(* CellEnterFunc) (BasicCell *cell, int *cursor_position, int *start_selection, int *end_selection)
 
typedef void(* CellModifyVerifyFunc) (BasicCell *cell, const char *add_str, int add_str_len, const char *new_value, int new_value_len, int *cursor_position, int *start_selection, int *end_selection)
 
typedef gboolean(* CellDirectUpdateFunc) (BasicCell *cell, int *cursor_position, int *start_selection, int *end_selection, gpointer gui_data)
 
typedef void(* CellLeaveFunc) (BasicCell *cell)
 
typedef void(* CellRealizeFunc) (BasicCell *cell, gpointer gui_handle)
 
typedef void(* CellMoveFunc) (BasicCell *cell)
 
typedef void(* CellDestroyFunc) (BasicCell *cell)
 
typedef const char *(* DoclinkcellStringGetter) (char flag)
 
typedef gboolean(* DoclinkcellConfirm) (char old_flag, gpointer data)
 
typedef const char *(* RecnCellStringGetter) (char flag)
 
typedef gboolean(* RecnCellConfirm) (char old_flag, gpointer data)
 

Enumerations

enum  CellAlignment { CELL_ALIGN_RIGHT, CELL_ALIGN_CENTER, CELL_ALIGN_LEFT }
 

Functions

gboolean gnc_cell_name_equal (const char *cell_name_1, const char *cell_name_2)
 
BasicCell * gnc_basic_cell_new (void)
 
void gnc_basic_cell_init (BasicCell *bcell)
 
void gnc_basic_cell_destroy (BasicCell *bcell)
 
void gnc_basic_cell_set_name (BasicCell *cell, const char *name)
 
gboolean gnc_basic_cell_has_name (BasicCell *cell, const char *name)
 
void gnc_basic_cell_set_type_name (BasicCell *cell, const gchar *type_name)
 
gboolean gnc_basic_cell_has_type_name (BasicCell *cell, const gchar *type_name)
 
void gnc_basic_cell_set_sample_text (BasicCell *cell, const char *sample_text)
 
void gnc_basic_cell_set_alignment (BasicCell *cell, CellAlignment alignment)
 
void gnc_basic_cell_set_expandable (BasicCell *cell, gboolean expandable)
 
void gnc_basic_cell_set_span (BasicCell *cell, gboolean span)
 
const char * gnc_basic_cell_get_value (BasicCell *cell)
 
void gnc_basic_cell_set_value (BasicCell *bcell, const char *value)
 
gboolean gnc_basic_cell_get_changed (BasicCell *cell)
 
gboolean gnc_basic_cell_get_conditionally_changed (BasicCell *cell)
 
void gnc_basic_cell_set_changed (BasicCell *cell, gboolean changed)
 
void gnc_basic_cell_set_conditionally_changed (BasicCell *cell, gboolean changed)
 
void gnc_basic_cell_set_value_internal (BasicCell *bcell, const char *value)
 
char * gnc_basic_cell_validate (BasicCell *bcell, GNCPrintAmountInfo print_info, const char *change, const char *newval, const char *toks, gint *cursor_position)
 
CellFactory * gnc_cell_factory_new (void)
 
void gnc_cell_factory_destroy (CellFactory *cf)
 
void gnc_cell_factory_add_cell_type (CellFactory *cf, const char *cell_type_name, CellCreateFunc cell_creator)
 
BasicCell * gnc_cell_factory_make_cell (CellFactory *cf, const char *cell_type_name)
 
BasicCell * gnc_checkbox_cell_new (void)
 
void gnc_checkbox_cell_set_flag (CheckboxCell *cell, gboolean flag)
 
gboolean gnc_checkbox_cell_get_flag (CheckboxCell *cell)
 
const char * gnc_checkbox_cell_get_string (gboolean flag)
 
BasicCell * gnc_combo_cell_new (void)
 
void gnc_combo_cell_init (ComboCell *cell)
 
void gnc_combo_cell_set_value (ComboCell *cell, const char *value)
 
void gnc_combo_cell_clear_menu (ComboCell *cell)
 
void gnc_combo_cell_add_menu_item (ComboCell *cell, const char *menustr)
 Add a menu item to the list. More...
 
void gnc_combo_cell_add_account_menu_item (ComboCell *cell, char *menustr)
 Add a 'account name' menu item to the list. More...
 
void gnc_combo_cell_set_sort_enabled (ComboCell *cell, gboolean enabled)
 Enable sorting of the menu item's contents. More...
 
void gnc_combo_cell_set_strict (ComboCell *cell, gboolean strict)
 Determines whether the cell will accept strings not in the menu. More...
 
void gnc_combo_cell_set_complete_char (ComboCell *cell, gunichar complete_char)
 Sets a character used for special completion processing. More...
 
void gnc_combo_cell_add_ignore_string (ComboCell *cell, const char *ignore_string)
 Add a string to a list of strings which, if the cell has that value, will cause the cell to be uneditable on 'enter'. More...
 
void gnc_combo_cell_set_autosize (ComboCell *cell, gboolean autosize)
 Determines whether the popup list autosizes itself or uses all available space. More...
 
void gnc_combo_cell_use_quickfill_cache (ComboCell *cell, QuickFill *shared_qf)
 Tell the combocell to use a shared QuickFill object. More...
 
void gnc_combo_cell_use_list_store_cache (ComboCell *cell, gpointer data)
 
BasicCell * gnc_completion_cell_new (void)
 
void gnc_completion_cell_init (CompletionCell *cell)
 
void gnc_completion_cell_set_value (CompletionCell *cell, const char *value)
 
void gnc_completion_cell_clear_menu (CompletionCell *cell)
 
void gnc_completion_cell_add_menu_item (CompletionCell *cell, const char *menustr)
 Add a menu item to the hash table list. More...
 
void gnc_completion_cell_set_sort_enabled (CompletionCell *cell, gboolean enabled)
 Enable sorting of the menu item's contents. More...
 
void gnc_completion_cell_set_strict (CompletionCell *cell, gboolean strict)
 Determines whether the cell will accept strings not in the menu. More...
 
void gnc_completion_cell_set_autosize (CompletionCell *cell, gboolean autosize)
 Determines whether the popup list autosizes itself or uses all available space. More...
 
void gnc_completion_cell_reverse_sort (CompletionCell *cell, gboolean is_reversed)
 Register the sort direction. More...
 
BasicCell * gnc_date_cell_new (void)
 installs a callback to handle date recording
 
void gnc_date_cell_set_value (DateCell *cell, int day, int mon, int year)
 Accepts a numeric date and sets the contents of the date cell to that value. More...
 
void gnc_date_cell_set_value_secs (DateCell *cell, time64 secs)
 Sets the contents of the cell with seconds before or since the Unix epoch. More...
 
void gnc_date_cell_commit (DateCell *cell)
 Commits any pending changes to the value of the cell. More...
 
void gnc_date_cell_get_date (DateCell *cell, time64 *time, gboolean warn)
 Set a time64 to the value in the DateCell. More...
 
BasicCell * gnc_doclink_cell_new (void)
 
void gnc_doclink_cell_set_flag (Doclinkcell *cell, char flag)
 
char gnc_doclink_cell_get_flag (Doclinkcell *cell)
 
void gnc_doclink_cell_set_confirm_cb (Doclinkcell *cell, DoclinkcellConfirm confirm_cb, gpointer data)
 
void gnc_doclink_cell_set_string_getter (Doclinkcell *cell, DoclinkcellStringGetter getter)
 
void gnc_doclink_cell_set_valid_flags (Doclinkcell *cell, const char *flags, char default_flag)
 note that More...
 
void gnc_doclink_cell_set_flag_order (Doclinkcell *cell, const char *flags)
 
void gnc_doclink_cell_set_read_only (Doclinkcell *cell, gboolean read_only)
 
void gnc_doclink_cell_set_use_glyphs (Doclinkcell *cell)
 
gboolean gnc_doclink_get_use_glyphs (Doclinkcell *cell)
 
const char * gnc_doclink_get_glyph_from_flag (char link_flag)
 
BasicCell * gnc_formula_cell_new (void)
 
void gnc_formula_cell_set_value (FormulaCell *fc, const char *newVal)
 
BasicCell * gnc_num_cell_new (void)
 
void gnc_num_cell_set_value (NumCell *cell, const char *str)
 
gboolean gnc_num_cell_set_last_num (NumCell *cell, const char *str)
 
BasicCell * gnc_price_cell_new (void)
 installs a callback to handle price recording
 
gnc_numeric gnc_price_cell_get_value (PriceCell *cell)
 return the value of a price cell
 
gboolean gnc_price_cell_set_value (PriceCell *cell, gnc_numeric amount)
 updates amount, returns TRUE if string representation actually changed
 
void gnc_price_cell_set_fraction (PriceCell *cell, int fraction)
 Sets the fraction used for rounding. More...
 
void gnc_price_cell_blank (PriceCell *cell)
 Sets the cell as blank, regardless of the blank_zero value.
 
void gnc_price_cell_set_blank_zero (PriceCell *cell, gboolean blank_zero)
 determines whether 0 values are left blank or printed. More...
 
void gnc_price_cell_set_print_info (PriceCell *cell, GNCPrintAmountInfo print_info)
 set the printing context of the price cell
 
void gnc_price_cell_set_debt_credit_value (PriceCell *debit, PriceCell *credit, gnc_numeric amount)
 updates two cells; the deb cell if amt is negative, the credit cell if amount is positive, and makes the other cell blank. More...
 
BasicCell * gnc_quickfill_cell_new (void)
 
void gnc_quickfill_cell_set_value (QuickFillCell *cell, const char *value)
 sets the current cell value to the indicated string, simultaneously adding the string to the quick-fill tree.
 
void gnc_quickfill_cell_set_sort (QuickFillCell *cell, QuickFillSort sort)
 
void gnc_quickfill_cell_add_completion (QuickFillCell *cell, const char *completion)
 
void gnc_quickfill_cell_use_quickfill_cache (QuickFillCell *cell, QuickFill *shared_qf)
 Lets the cell use the given shared quickfill object instead of the one it owns internally. More...
 
BasicCell * gnc_recn_cell_new (void)
 
void gnc_recn_cell_set_flag (RecnCell *cell, char flag)
 
char gnc_recn_cell_get_flag (RecnCell *cell)
 
void gnc_recn_cell_set_confirm_cb (RecnCell *cell, RecnCellConfirm confirm_cb, gpointer data)
 
void gnc_recn_cell_set_string_getter (RecnCell *cell, RecnCellStringGetter getter)
 
void gnc_recn_cell_set_valid_flags (RecnCell *cell, const char *flags, char default_flag)
 note that chars is copied into the RecnCell directly, but remains the "property" of the caller. More...
 
void gnc_recn_cell_set_flag_order (RecnCell *cell, const char *flags)
 
void gnc_recn_cell_set_read_only (RecnCell *cell, gboolean read_only)
 

Detailed Description

A "Cell" is an active object which is designed to read a specific kind of user input.

A Cell object has callbacks that are called when the user enters the cell (e.g. by mouse-clicking on a cell in a table, or tabbing into it), when the user attempts to modify text in the cell (e.g. by typing in it), and when the user leaves the cell (e.g. by mouse-clicking elsewhere, or tabbing away).

Special-purpose cells can be created by "inheriting" from the basic cell object. Thus, there are special-purpose cells for handling dates, pull-down menus, text fields with auto-completion from a list of alternatives, monetary amounts, etc.

Cells implementations may or may not contain GUI code. Cells which require only that text be displayed are completely "GUI-independent", that is, they depend on the underlying table to display the text. Cells which require additional GUI elements (such as pull-down menus) must implement the proper GUI handling on their own (using, e.g., GTK).

Function Documentation

◆ gnc_combo_cell_add_account_menu_item()

void gnc_combo_cell_add_account_menu_item ( ComboCell cell,
char *  menustr 
)

Add a 'account name' menu item to the list.

When testing for equality with the currently selected item, this function will ignore the characters normally used to separate account names.

Definition at line 463 of file combocell-gnome.c.

464 {
465  PopBox* box;
466 
467  if (cell == NULL)
468  return;
469  if (menustr == NULL)
470  return;
471 
472  box = cell->cell.gui_private;
473 
474  if (box->item_list != NULL)
475  {
476  block_list_signals (cell);
477 
478  gnc_item_list_append (box->item_list, menustr);
479  if (cell->cell.value)
480  {
481  gchar* menu_copy = g_strdup (menustr);
482  gchar* value_copy = g_strdup (cell->cell.value);
483  g_strdelimit (menu_copy, "-:/\\.", ' ');
484  g_strdelimit (value_copy, "-:/\\.", ' ');
485  if (strcmp (menu_copy, value_copy) == 0)
486  {
487  gnc_combo_cell_set_value (cell, menustr);
488  gnc_item_list_select (box->item_list, menustr);
489  }
490  g_free (value_copy);
491  g_free (menu_copy);
492  }
493  unblock_list_signals (cell);
494  }
495 
496  /* If we're going to be using a pre-fab quickfill,
497  * then don't fill it in here */
498  if (FALSE == box->use_quickfill_cache)
499  {
500  gnc_quickfill_insert (box->qf, menustr, QUICKFILL_ALPHA);
501  }
502 }
void gnc_quickfill_insert(QuickFill *qf, const char *text, QuickFillSort sort)
Add the string "text" to the collection of searchable strings.
Definition: QuickFill.c:229

◆ gnc_combo_cell_add_ignore_string()

void gnc_combo_cell_add_ignore_string ( ComboCell cell,
const char *  ignore_string 
)

Add a string to a list of strings which, if the cell has that value, will cause the cell to be uneditable on 'enter'.

Definition at line 1110 of file combocell-gnome.c.

1112 {
1113  PopBox* box;
1114 
1115  if (cell == NULL)
1116  return;
1117 
1118  if (!ignore_string)
1119  return;
1120 
1121  box = cell->cell.gui_private;
1122 
1123  box->ignore_strings = g_list_prepend (box->ignore_strings,
1124  g_strdup (ignore_string));
1125 }

◆ gnc_combo_cell_add_menu_item()

void gnc_combo_cell_add_menu_item ( ComboCell cell,
const char *  menustr 
)

Add a menu item to the list.

Definition at line 424 of file combocell-gnome.c.

425 {
426  PopBox* box;
427 
428  if (cell == NULL)
429  return;
430  if (menustr == NULL)
431  return;
432 
433  box = cell->cell.gui_private;
434 
435  if (box->item_list != NULL)
436  {
437  block_list_signals (cell);
438 
439  gnc_item_list_append (box->item_list, menustr);
440  if (cell->cell.value &&
441  (strcmp (menustr, cell->cell.value) == 0))
442  gnc_item_list_select (box->item_list, menustr);
443 
444  unblock_list_signals (cell);
445  }
446  else
447  {
448  GtkTreeIter iter;
449 
450  gtk_list_store_append (box->tmp_store, &iter);
451  gtk_list_store_set (box->tmp_store, &iter, 0, menustr, -1);
452  }
453 
454  /* If we're going to be using a pre-fab quickfill,
455  * then don't fill it in here */
456  if (FALSE == box->use_quickfill_cache)
457  {
458  gnc_quickfill_insert (box->qf, menustr, QUICKFILL_ALPHA);
459  }
460 }
void gnc_quickfill_insert(QuickFill *qf, const char *text, QuickFillSort sort)
Add the string "text" to the collection of searchable strings.
Definition: QuickFill.c:229

◆ gnc_combo_cell_set_autosize()

void gnc_combo_cell_set_autosize ( ComboCell cell,
gboolean  autosize 
)

Determines whether the popup list autosizes itself or uses all available space.

FALSE by default.

Definition at line 1128 of file combocell-gnome.c.

1129 {
1130  PopBox* box;
1131 
1132  if (!cell)
1133  return;
1134 
1135  box = cell->cell.gui_private;
1136  if (!box)
1137  return;
1138 
1139  box->autosize = autosize;
1140 }

◆ gnc_combo_cell_set_complete_char()

void gnc_combo_cell_set_complete_char ( ComboCell cell,
gunichar  complete_char 
)

Sets a character used for special completion processing.

Definition at line 1097 of file combocell-gnome.c.

1098 {
1099  PopBox* box;
1100 
1101  if (cell == NULL)
1102  return;
1103 
1104  box = cell->cell.gui_private;
1105 
1106  box->complete_char = complete_char;
1107 }

◆ gnc_combo_cell_set_sort_enabled()

void gnc_combo_cell_set_sort_enabled ( ComboCell cell,
gboolean  enabled 
)

Enable sorting of the menu item's contents.

Loading the item is much faster with sorting disabled.

Definition at line 349 of file combocell-gnome.c.

350 {
351  PopBox* box;
352 
353  if (cell == NULL)
354  return;
355 
356  box = cell->cell.gui_private;
357  if (box->item_list == NULL)
358  return;
359 
360  block_list_signals (cell);
361  gnc_item_list_set_sort_column (box->item_list, 0);
362  unblock_list_signals (cell);
363 }

◆ gnc_combo_cell_set_strict()

void gnc_combo_cell_set_strict ( ComboCell cell,
gboolean  strict 
)

Determines whether the cell will accept strings not in the menu.

Defaults to strict, i.e., only menu items are accepted.

Definition at line 1084 of file combocell-gnome.c.

1085 {
1086  PopBox* box;
1087 
1088  if (cell == NULL)
1089  return;
1090 
1091  box = cell->cell.gui_private;
1092 
1093  box->strict = strict;
1094 }

◆ gnc_combo_cell_use_quickfill_cache()

void gnc_combo_cell_use_quickfill_cache ( ComboCell cell,
QuickFill *  shared_qf 
)

Tell the combocell to use a shared QuickFill object.

Using this routine can dramatically improve performance when creating combocells with a large number of entries. For example, users with thousands of accounts are complaining about 10-second register startup times, of which 98% of the cpu is spent building the multi-thousand entry quickfill. When a shared quickfill is specified, the combo-cell will not add to nor delete the quickfill; it is the users resonsibility to manage the quickfill object. The combocell will not make a copy of the quickfill.

Definition at line 398 of file combocell-gnome.c.

399 {
400  PopBox* box;
401 
402  if (cell == NULL) return;
403 
404  box = cell->cell.gui_private;
405  if (NULL == box) return;
406 
407  if (FALSE == box->use_quickfill_cache)
408  {
409  box->use_quickfill_cache = TRUE;
410  gnc_quickfill_destroy (box->qf);
411  }
412  box->qf = shared_qf;
413 }

◆ gnc_completion_cell_add_menu_item()

void gnc_completion_cell_add_menu_item ( CompletionCell cell,
const char *  menustr 
)

Add a menu item to the hash table list.

Definition at line 466 of file completioncell-gnome.c.

468 {
469  if (!cell || !menustr)
470  return;
471 
472  PopBox* box = cell->cell.gui_private;
473 
474  if (box->item_hash)
475  {
476  gpointer value = g_hash_table_lookup (box->item_hash, menustr);
477  gboolean update = FALSE;
478  if (value)
479  {
480  if (!box->register_is_reversed)
481  update = TRUE;
482  }
483  else
484  update = TRUE;
485 
486  if (update)
487  {
488  g_hash_table_insert (box->item_hash, g_strdup (menustr),
489  GINT_TO_POINTER(box->occurrence));
490  }
491  box->occurrence++;
492  }
493 }

◆ gnc_completion_cell_reverse_sort()

void gnc_completion_cell_reverse_sort ( CompletionCell cell,
gboolean  is_reversed 
)

Register the sort direction.

Used to determine in what order the completion should present the list. FALSE by default

Definition at line 807 of file completioncell-gnome.c.

808 {
809  if (!cell)
810  return;
811 
812  PopBox* box = cell->cell.gui_private;
813 
814  if (is_reversed != box->register_is_reversed)
815  {
816  gnc_completion_cell_clear_menu (cell);
817  box->register_is_reversed = is_reversed;
818  box->occurrence = 0;
819  }
820 }

◆ gnc_completion_cell_set_autosize()

void gnc_completion_cell_set_autosize ( CompletionCell cell,
gboolean  autosize 
)

Determines whether the popup list autosizes itself or uses all available space.

FALSE by default.

Definition at line 1052 of file completioncell-gnome.c.

1053 {
1054  if (!cell)
1055  return;
1056 
1057  PopBox* box = cell->cell.gui_private;
1058  if (!box)
1059  return;
1060 
1061  box->autosize = autosize;
1062 }

◆ gnc_completion_cell_set_sort_enabled()

void gnc_completion_cell_set_sort_enabled ( CompletionCell cell,
gboolean  enabled 
)

Enable sorting of the menu item's contents.

Definition at line 394 of file completioncell-gnome.c.

396 {
397  if (!cell)
398  return;
399 
400  PopBox* box = cell->cell.gui_private;
401  box->sort_enabled = enabled;
402 }

◆ gnc_completion_cell_set_strict()

void gnc_completion_cell_set_strict ( CompletionCell cell,
gboolean  strict 
)

Determines whether the cell will accept strings not in the menu.

Defaults to strict, i.e., only menu items are accepted.

Definition at line 1039 of file completioncell-gnome.c.

1040 {
1041  if (!cell)
1042  return;
1043 
1044  PopBox* box = cell->cell.gui_private;
1045  if (!box)
1046  return;
1047 
1048  box->strict = strict;
1049 }

◆ gnc_date_cell_commit()

void gnc_date_cell_commit ( DateCell cell)

Commits any pending changes to the value of the cell.

That is, it will take the cells current string value, and parse it into a month-day-year value.

Why is this needed? Basically, while the user is typing into the cell, we do not even try to parse the date, lest we confuse things royally. Normally, when the user leaves this cell, and moves to another, we parse the date and print it nicely and cleanly into the cell. But it can happen that we want to get the accurate contents of the date cell before we've left it, e.g. if the user has clicked on the "commit" button. This is the routine to call for that.

Definition at line 462 of file datecell-gnome.c.

463 {
464  PopBox *box = cell->cell.gui_private;
465  char buff[DATE_BUF];
466 
467  if (!cell)
468  return;
469 
470  gnc_parse_date (&(box->date), cell->cell.value, FALSE);
471 
473  box->date.tm_mday,
474  box->date.tm_mon + 1,
475  box->date.tm_year + 1900);
476 
477  gnc_basic_cell_set_value_internal (&cell->cell, buff);
478 
479  if (!box->date_picker)
480  return;
481 
482  block_picker_signals (cell);
483  gnc_date_picker_set_date (box->date_picker,
484  box->date.tm_mday,
485  box->date.tm_mon,
486  box->date.tm_year + 1900);
487  unblock_picker_signals (cell);
488 }
size_t qof_print_date_dmy_buff(gchar *buff, size_t buflen, int day, int month, int year)
qof_print_date_dmy_buff Convert a date as day / month / year integers into a localized string represe...
#define MAX_DATE_LENGTH
The maximum length of a string created by the date printers.
Definition: gnc-date.h:108

◆ gnc_date_cell_get_date()

void gnc_date_cell_get_date ( DateCell cell,
time64 time,
gboolean  warn 
)

Set a time64 to the value in the DateCell.

Parameters
cellThe DateCell
timeA time64* to which the function will write the time.
warnWhether to warn of parse errors or silently change to a valid one.

Definition at line 721 of file datecell-gnome.c.

722 {
723  PopBox *box = cell->cell.gui_private;
724  if (!cell || !time)
725  return;
726 
727  gnc_parse_date (&(box->date), cell->cell.value, warn);
728  *time = gnc_mktime (&box->date);
729 }
time64 gnc_mktime(struct tm *time)
calculate seconds from the epoch given a time struct
Definition: gnc-date.cpp:219

◆ gnc_date_cell_set_value()

void gnc_date_cell_set_value ( DateCell cell,
int  day,
int  mon,
int  year 
)

Accepts a numeric date and sets the contents of the date cell to that value.

The value day, month, year should follow the regular written conventions.

Parameters
cellThe DateCell to set
dayThe day of the month, 1..31
monthThe month of the year, 1..12
yearThe year, 4 digits, common era

Definition at line 406 of file datecell-gnome.c.

407 {
408  PopBox *box = cell->cell.gui_private;
409  struct tm dada;
410  char buff[DATE_BUF];
411 
412  dada.tm_mday = day;
413  dada.tm_mon = mon - 1;
414  dada.tm_year = year - 1900;
415 
416  gnc_tm_set_day_start(&dada);
417  gnc_mktime (&dada);
418 
419  box->date.tm_mday = dada.tm_mday;
420  box->date.tm_mon = dada.tm_mon;
421  box->date.tm_year = dada.tm_year;
422 
423  qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH, dada.tm_mday, dada.tm_mon + 1, dada.tm_year + 1900);
424 
425  gnc_basic_cell_set_value_internal (&cell->cell, buff);
426 
427  if (!box->date_picker)
428  return;
429 
430  block_picker_signals (cell);
431  gnc_date_picker_set_date (box->date_picker, day, mon - 1, year);
432  unblock_picker_signals (cell);
433 }
size_t qof_print_date_dmy_buff(gchar *buff, size_t buflen, int day, int month, int year)
qof_print_date_dmy_buff Convert a date as day / month / year integers into a localized string represe...
time64 gnc_mktime(struct tm *time)
calculate seconds from the epoch given a time struct
Definition: gnc-date.cpp:219
#define MAX_DATE_LENGTH
The maximum length of a string created by the date printers.
Definition: gnc-date.h:108

◆ gnc_date_cell_set_value_secs()

void gnc_date_cell_set_value_secs ( DateCell cell,
time64  secs 
)

Sets the contents of the cell with seconds before or since the Unix epoch.

Parameters
cellThe DateCell to set
secsSeconds before or since the Unix epoch, 1 January 1970 CE.

Definition at line 436 of file datecell-gnome.c.

437 {
438  PopBox *box = cell->cell.gui_private;
439  char buff[DATE_BUF];
440 
441  gnc_localtime_r (&secs, &(box->date));
442 
444  box->date.tm_mday,
445  box->date.tm_mon + 1,
446  box->date.tm_year + 1900);
447 
448  gnc_basic_cell_set_value_internal (&cell->cell, buff);
449 
450  if (!box->date_picker)
451  return;
452 
453  block_picker_signals (cell);
454  gnc_date_picker_set_date (box->date_picker,
455  box->date.tm_mday,
456  box->date.tm_mon,
457  box->date.tm_year + 1900);
458  unblock_picker_signals (cell);
459 }
size_t qof_print_date_dmy_buff(gchar *buff, size_t buflen, int day, int month, int year)
qof_print_date_dmy_buff Convert a date as day / month / year integers into a localized string represe...
struct tm * gnc_localtime_r(const time64 *secs, struct tm *time)
fill out a time struct from a 64-bit time value adjusted for the current time zone.
Definition: gnc-date.cpp:115
#define MAX_DATE_LENGTH
The maximum length of a string created by the date printers.
Definition: gnc-date.h:108

◆ gnc_doclink_cell_set_valid_flags()

void gnc_doclink_cell_set_valid_flags ( Doclinkcell cell,
const char *  flags,
char  default_flag 
)

note that

Parameters
flagsis copied into the RecnCell directly, but remains the "property" of the caller. The caller must maintain the chars pointer, and the caller must setup a mechanism to 'free' the chars pointer. The rationale is that you may have many Doclinkcell objects that use the same set of flags.

Definition at line 236 of file doclinkcell.c.

238 {
239  g_return_if_fail (cell != NULL);
240  g_return_if_fail (flags != NULL);
241 
242  cell->valid_flags = (char *)flags;
243  cell->default_flag = default_flag;
244 }
char * valid_flags
The actual flag value.
Definition: doclinkcell.h:58
char default_flag
Automatic flag selection order.
Definition: doclinkcell.h:60

◆ gnc_price_cell_set_blank_zero()

void gnc_price_cell_set_blank_zero ( PriceCell cell,
gboolean  blank_zero 
)

determines whether 0 values are left blank or printed.

defaults to true.

Definition at line 263 of file pricecell.c.

264 {
265  if (cell == NULL)
266  return;
267 
268  cell->blank_zero = blank_zero;
269 }
gboolean blank_zero
fraction used for rounding, if 0 no rounding
Definition: pricecell.h:59

◆ gnc_price_cell_set_debt_credit_value()

void gnc_price_cell_set_debt_credit_value ( PriceCell debit,
PriceCell credit,
gnc_numeric  amount 
)

updates two cells; the deb cell if amt is negative, the credit cell if amount is positive, and makes the other cell blank.

Definition at line 281 of file pricecell.c.

284 {
285  /* debits are positive, credits are negative */
286  if (gnc_numeric_positive_p (amount))
287  {
288  gnc_price_cell_set_value (debit, amount);
289  gnc_price_cell_set_value (credit, gnc_numeric_zero ());
290  }
291  else
292  {
293  gnc_price_cell_set_value (debit, gnc_numeric_zero ());
294  gnc_price_cell_set_value (credit, gnc_numeric_neg (amount));
295  }
296 }
gnc_numeric gnc_numeric_neg(gnc_numeric a)
Returns a newly created gnc_numeric that is the negative of the given gnc_numeric value...
gboolean gnc_numeric_positive_p(gnc_numeric a)
Returns 1 if a > 0, otherwise returns 0.
gboolean gnc_price_cell_set_value(PriceCell *cell, gnc_numeric amount)
updates amount, returns TRUE if string representation actually changed
Definition: pricecell.c:219

◆ gnc_price_cell_set_fraction()

void gnc_price_cell_set_fraction ( PriceCell cell,
int  fraction 
)

Sets the fraction used for rounding.

If 0, no rounding is performed.

Definition at line 242 of file pricecell.c.

243 {
244  if (cell == NULL)
245  return;
246 
247  cell->fraction = ABS (fraction);
248 }
int fraction
the amount associated with this cell
Definition: pricecell.h:58

◆ gnc_quickfill_cell_use_quickfill_cache()

void gnc_quickfill_cell_use_quickfill_cache ( QuickFillCell cell,
QuickFill *  shared_qf 
)

Lets the cell use the given shared quickfill object instead of the one it owns internally.

The cell will not delete the shared quickfill upon destruction.

Definition at line 346 of file quickfillcell.c.

347 {
348  g_assert(cell);
349  g_assert(shared_qf);
350 
351  if (!cell->use_quickfill_cache)
352  {
353  cell->use_quickfill_cache = TRUE;
354  gnc_quickfill_destroy (cell->qf);
355  }
356  cell->qf = shared_qf;
357 }
gboolean use_quickfill_cache
original string entered in original case
Definition: quickfillcell.h:53

◆ gnc_recn_cell_set_valid_flags()

void gnc_recn_cell_set_valid_flags ( RecnCell cell,
const char *  flags,
char  default_flag 
)

note that chars is copied into the RecnCell directly, but remains the "property" of the caller.

The caller must maintain the chars pointer, and the caller must setup a mechanism to 'free' the chars pointer. The rationale is that you may have many RecnCell objects that use the same set of flags – this saves you an alloc/free for each cell. - warlord 2001-11-28

Definition at line 196 of file recncell.c.

198 {
199  g_return_if_fail (cell != NULL);
200  g_return_if_fail (flags != NULL);
201 
202  cell->valid_flags = (char *)flags;
203  cell->default_flag = default_flag;
204 }
char default_flag
Automatic flag selection order.
Definition: recncell.h:55
char * valid_flags
The actual flag value.
Definition: recncell.h:53