GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
recncell.h
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 [email protected] *
20  * *
21 \********************************************************************/
22 
23 /*
24  * FILE:
25  * recncell.h
26  *
27  * FUNCTION:
28  * The RecnCell object implements a cell handler
29  * that will cycle through a series of single-character
30  * values when clicked upon by the mouse.
31  *
32  * HISTORY:
33  * Copyright (c) 1998 Linas Vepstas
34  * Copyright (c) 2000 Dave Peticolas
35  * Copyright (c) 2001 Derek Atkins
36  */
37 
38 #ifndef RECN_CELL_H
39 #define RECN_CELL_H
40 
41 #include <glib.h>
42 
43 #include "basiccell.h"
44 
45 typedef const char * (*RecnCellStringGetter) (char flag);
46 typedef gboolean (*RecnCellConfirm) (char old_flag, gpointer data);
47 
48 typedef struct
49 {
50  BasicCell cell;
51 
52  char flag; /* The actual flag value */
53 
54  char * valid_flags; /* The list of valid flags */
55  char * flag_order; /* Automatic flag selection order */
56  char default_flag; /* Default flag for unknown user input */
57 
58  RecnCellStringGetter get_string;
59  RecnCellConfirm confirm_cb;
60  gpointer confirm_data;
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 /*
76  * note that chars is copied into the RecnCell directly, but remains
77  * the "property" of the caller. The caller must maintain the chars
78  * pointer, and the caller must setup a mechanism to 'free' the chars
79  * pointer. The rationale is that you may have many RecnCell objects
80  * that use the same set of flags -- this saves you an alloc/free for
81  * each cell. - warlord 2001-11-28
82  */
83 void gnc_recn_cell_set_valid_flags (RecnCell *cell, const char *flags,
84  char default_flag);
85 void gnc_recn_cell_set_flag_order (RecnCell *cell, const char *flags);
86 
87 #endif
88