1 /********************************************************************\ 2 * recncell.h -- reconcile checkbox cell * 3 * * 4 * This program is free software; you can redistribute it and/or * 5 * modify it under the terms of the GNU General Public License as * 6 * published by the Free Software Foundation; either version 2 of * 7 * the License, or (at your option) any later version. * 8 * * 9 * This program is distributed in the hope that it will be useful, * 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 * GNU General Public License for more details. * 13 * * 14 * You should have received a copy of the GNU General Public License* 15 * along with this program; if not, contact: * 16 * * 17 * Free Software Foundation Voice: +1-617-542-5942 * 18 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 19 * Boston, MA 02110-1301, USA gnu@gnu.org * 20 * * 21 \********************************************************************/ 22 23 /** @addtogroup Cell Cell 24 * @{ 25 * @file recncell.h 26 * @struct RecnCell 27 * @brief The RecnCell object implements a cell handler 28 * that will cycle through a series of single-character 29 * values when clicked upon by the mouse. 30 */ 31 /* HISTORY: 32 * Copyright (c) 1998 Linas Vepstas 33 * Copyright (c) 2000 Dave Peticolas 34 * Copyright (c) 2001 Derek Atkins 35 */ 36 37 #ifndef RECN_CELL_H 38 #define RECN_CELL_H 39 40 #include <glib.h> 41 42 #include "basiccell.h" 43 44 typedef const char * (*RecnCellStringGetter) (char flag); 45 typedef gboolean (*RecnCellConfirm) (char old_flag, gpointer data); 46 47 typedef struct 48 { 49 BasicCell cell; 50 51 char flag; /** The actual flag value */ 52 53 char * valid_flags; /** The list of valid flags */ 54 char * flag_order; /** Automatic flag selection order */ 55 char default_flag; /** Default flag for unknown user input */ 56 57 RecnCellStringGetter get_string; 58 RecnCellConfirm confirm_cb; 59 gpointer confirm_data; 60 gboolean read_only; 61 } RecnCell; 62 63 BasicCell * gnc_recn_cell_new (void); 64 65 void gnc_recn_cell_set_flag (RecnCell *cell, char flag); 66 char gnc_recn_cell_get_flag (RecnCell *cell); 67 68 void gnc_recn_cell_set_confirm_cb (RecnCell *cell, 69 RecnCellConfirm confirm_cb, 70 gpointer data); 71 72 void gnc_recn_cell_set_string_getter (RecnCell *cell, 73 RecnCellStringGetter getter); 74 75 /** note that chars is copied into the RecnCell directly, but remains 76 * the "property" of the caller. The caller must maintain the chars 77 * pointer, and the caller must setup a mechanism to 'free' the chars 78 * pointer. The rationale is that you may have many RecnCell objects 79 * that use the same set of flags -- this saves you an alloc/free for 80 * each cell. - warlord 2001-11-28 81 */ 82 void gnc_recn_cell_set_valid_flags (RecnCell *cell, const char *flags, 83 char default_flag); 84 void gnc_recn_cell_set_flag_order (RecnCell *cell, const char *flags); 85 86 void gnc_recn_cell_set_read_only (RecnCell *cell, gboolean read_only); 87 /** @} */ 88 #endif 89