-
Notifications
You must be signed in to change notification settings - Fork 761
/
table.h
111 lines (84 loc) · 2.89 KB
/
table.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
* FILE:
* table.h
*
* FUNCTION:
* The table is the complete, displayed table.
* It consists of a header, followed by a simple
* list of repeated entries.
*
* It provides the mechanism to handle tab-trversing.
*
* HISTORY:
* Copyright (c) 1998 Linas Vepstas
*/
#ifndef __XACC_TABLE_H__
#define __XACC_TABLE_H__
#include <Xm/Xm.h>
#include "basiccell.h"
#include "cellblock.h"
typedef struct _Table {
/* num rows and cols are the number of times the
* cursor can tile the table in the vertical and
* horizontal directions */
int num_rows;
int num_cols;
CellBlock *header;
CellBlock *cursor;
int current_cursor_row;
int current_cursor_col;
/* callback that is called when the cursor is moved */
/* hack alert -- this should be a callback list, actually */
void (*move_cursor) (struct _Table *, void *client_data);
void * client_data;
/* string values for each cell,
* of dimension num_phys_rows * num_phys_cols */
char ***entries;
/* user hooks, of dimension num_rows * num_cols */
void ***user_data;
/* protected data -- vital for the implementation,
* but not something we want to generally expose */
Widget table_widget; /* the XbaeMatrix */
Widget next_tab_group; /* where to traverse in the end */
/* private data, caches, etc. */
/* This is black-box stuff that no user of this class
* should ever want to access */
/* the "tile size" is the number of rows &
* cols in the cursor */
int tile_width;
int tile_height;
/* the "physical" rows/cols are equal to
* the size of the tile times the number
* of tile rows/cols
*/
int num_header_rows;
int num_phys_rows;
int num_phys_cols;
/* This class implements tab-key and arrow key
* traversal through the cells of the table.
* To perform this traversal, the location
* of the "previous" cell having input focus
* is required.
*/
int prev_phys_traverse_row;
int prev_phys_traverse_col;
} Table;
Table * xaccMallocTable (void);
void xaccInitTable (Table *);
void xaccSetTableSize (Table * table, int tile_rows, int tile_cols);
/* create the widget */
Widget xaccCreateTable (Table *, Widget parent, char * name);
void xaccNextTabGroup (Table *, Widget);
void xaccDestroyTable (Table *);
/* redraw the table GUI */
void xaccRefreshTableGUI (Table *);
/* Make the indicated cell block be the cursor for this table */
void xaccSetCursor (Table *, CellBlock *);
/* move the cursor (but not the GUI) to the indicated location. */
void xaccMoveCursor (Table *, int virt_row, int virt_col);
/* move the cursor GUI to the indicated location. */
void xaccMoveCursorGUI (Table *, int virt_row, int virt_col);
/* copy text in the cursor cells to the table */
void xaccCommitCursor (Table *);
#endif __XACC_TABLE_H__
/* ================== end of file ======================= */