48 static void gnc_recn_cell_set_value (BasicCell *_cell,
const char *value);
52 gnc_recn_cell_get_string (
RecnCell *cell,
char flag)
54 static char str[2] = { 0, 0 };
65 gnc_recn_cell_enter (BasicCell *_cell,
73 if (cell->confirm_cb &&
74 ! (cell->confirm_cb (cell->flag, cell->confirm_data)))
77 if (cell->read_only == TRUE)
81 this_flag = strchr (cell->
flag_order, cell->flag);
83 if (this_flag == NULL || *this_flag ==
'\0')
95 if (*this_flag !=
'\0')
96 cell->flag = *this_flag;
102 gnc_recn_cell_set_flag (cell, cell->flag);
110 gnc_basic_cell_init (&cell->cell);
112 gnc_recn_cell_set_flag (cell,
'\0');
113 cell->confirm_cb = NULL;
117 cell->read_only = FALSE;
119 cell->cell.enter_cell = gnc_recn_cell_enter;
120 cell->cell.set_value = gnc_recn_cell_set_value;
124 gnc_recn_cell_new (
void)
130 gnc_recn_cell_init (cell);
137 gnc_recn_cell_set_value (BasicCell *_cell,
const char *value)
142 if (!value || *value ==
'\0')
145 gnc_basic_cell_set_value_internal (_cell,
"");
153 gnc_recn_cell_set_flag (cell, flag);
157 gnc_recn_cell_set_flag (
RecnCell *cell,
char flag)
161 g_return_if_fail (cell != NULL);
164 string = gnc_recn_cell_get_string (cell, flag);
166 gnc_basic_cell_set_value_internal (&cell->cell,
string);
170 gnc_recn_cell_get_flag (
RecnCell *cell)
172 g_return_val_if_fail (cell != NULL,
'\0');
178 gnc_recn_cell_set_string_getter (
RecnCell *cell,
179 RecnCellStringGetter get_string)
181 g_return_if_fail (cell != NULL);
186 gnc_recn_cell_set_confirm_cb (
RecnCell *cell, RecnCellConfirm confirm_cb,
189 g_return_if_fail (cell != NULL);
191 cell->confirm_cb = confirm_cb;
192 cell->confirm_data = data;
199 g_return_if_fail (cell != NULL);
200 g_return_if_fail (flags != NULL);
207 gnc_recn_cell_set_flag_order (
RecnCell *cell,
const char *flags)
209 g_return_if_fail (cell != NULL);
210 g_return_if_fail (flags != NULL);
216 gnc_recn_cell_set_read_only (
RecnCell *cell, gboolean read_only)
218 g_return_if_fail (cell != NULL);
219 cell->read_only = read_only;
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 RecnCell object implements a cell handler that will cycle through a series of single-character va...
char default_flag
Automatic flag selection order.
RecnCellStringGetter get_string
Default flag for unknown user input.
char * flag_order
The list of valid flags.
char * valid_flags
The actual flag value.
All type declarations for the whole Gnucash engine.