GnuCash 2.4.99
recncell.h
00001 /********************************************************************\
00002  * recncell.h -- reconcile checkbox cell                            *
00003  *                                                                  *
00004  * This program is free software; you can redistribute it and/or    *
00005  * modify it under the terms of the GNU General Public License as   *
00006  * published by the Free Software Foundation; either version 2 of   *
00007  * the License, or (at your option) any later version.              *
00008  *                                                                  *
00009  * This program is distributed in the hope that it will be useful,  *
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00012  * GNU General Public License for more details.                     *
00013  *                                                                  *
00014  * You should have received a copy of the GNU General Public License*
00015  * along with this program; if not, contact:                        *
00016  *                                                                  *
00017  * Free Software Foundation           Voice:  +1-617-542-5942       *
00018  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
00019  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
00020  *                                                                  *
00021 \********************************************************************/
00022 
00023 /*
00024  * FILE:
00025  * recncell.h
00026  *
00027  * FUNCTION:
00028  * The RecnCell object implements a cell handler
00029  * that will cycle through a series of single-character
00030  * values when clicked upon by the mouse.
00031  *
00032  * HISTORY:
00033  * Copyright (c) 1998 Linas Vepstas
00034  * Copyright (c) 2000 Dave Peticolas
00035  * Copyright (c) 2001 Derek Atkins
00036  */
00037 
00038 #ifndef RECN_CELL_H
00039 #define RECN_CELL_H
00040 
00041 #include <glib.h>
00042 
00043 #include "basiccell.h"
00044 
00045 typedef const char * (*RecnCellStringGetter) (char flag);
00046 typedef gboolean (*RecnCellConfirm) (char old_flag, gpointer data);
00047 
00048 typedef struct
00049 {
00050     BasicCell cell;
00051 
00052     char flag; /* The actual flag value */
00053 
00054     char * valid_flags;         /* The list of valid flags */
00055     char * flag_order;          /* Automatic flag selection order */
00056     char        default_flag;           /* Default flag for unknown user input */
00057 
00058     RecnCellStringGetter get_string;
00059     RecnCellConfirm confirm_cb;
00060     gpointer confirm_data;
00061 } RecnCell;
00062 
00063 BasicCell * gnc_recn_cell_new (void);
00064 
00065 void        gnc_recn_cell_set_flag (RecnCell *cell, char flag);
00066 char        gnc_recn_cell_get_flag (RecnCell *cell);
00067 
00068 void        gnc_recn_cell_set_confirm_cb (RecnCell *cell,
00069         RecnCellConfirm confirm_cb,
00070         gpointer data);
00071 
00072 void        gnc_recn_cell_set_string_getter (RecnCell *cell,
00073         RecnCellStringGetter getter);
00074 
00075 /*
00076  * note that chars is copied into the RecnCell directly, but remains
00077  * the "property" of the caller.  The caller must maintain the chars
00078  * pointer, and the caller must setup a mechanism to 'free' the chars
00079  * pointer.  The rationale is that you may have many RecnCell objects
00080  * that use the same set of flags -- this saves you an alloc/free for
00081  * each cell.  - warlord  2001-11-28
00082  */
00083 void        gnc_recn_cell_set_valid_flags (RecnCell *cell, const char *flags,
00084         char default_flag);
00085 void        gnc_recn_cell_set_flag_order (RecnCell *cell, const char *flags);
00086 
00087 #endif
00088 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines