1 /********************************************************************\
2  * table-control.h -- table control object                          *
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 #ifndef TABLE_CONTROL_H
24 #define TABLE_CONTROL_H
25 
26 #include "register-common.h"
27 
28 /** @addtogroup Table Table
29  * @{
30  * @file table-control.h
31  */
32 typedef enum
33 {
34     GNC_TABLE_TRAVERSE_POINTER,
35     GNC_TABLE_TRAVERSE_LEFT,
36     GNC_TABLE_TRAVERSE_RIGHT,
37     GNC_TABLE_TRAVERSE_UP,
38     GNC_TABLE_TRAVERSE_DOWN
39 } gncTableTraversalDir;
40 
41 typedef void (*TableMoveFunc) (VirtualLocation *new_virt_loc,
42                                gpointer user_data);
43 
44 typedef gboolean (*TableTraverseFunc) (VirtualLocation *new_virt_loc,
45                                        gncTableTraversalDir dir,
46                                        gpointer user_data);
47 
48 typedef struct table_control
49 {
50     /* called when the cursor is moved */
51     TableMoveFunc move_cursor;
52 
53     gboolean allow_move;
54 
55     /* called to determine traversal when user requests a move */
56     TableTraverseFunc traverse;
57 
58     gpointer user_data;
59 } TableControl;
60 
61 
62 TableControl * gnc_table_control_new (void);
63 void gnc_table_control_destroy (TableControl *control);
64 
65 void gnc_table_control_allow_move (TableControl *control,
66                                    gboolean allow_move);
67 
68 /** @} */
69 #endif
70