1 |
pippijn |
1.1 |
/* |
2 |
|
|
* Copyright © 2007 William Pitcock <nenolod -at- sacredspiral.co.uk> |
3 |
pippijn |
1.2 |
* Rights to this code are as documented in doc/pod/license.pod. |
4 |
pippijn |
1.1 |
* |
5 |
|
|
* Table rendering class. |
6 |
|
|
* |
7 |
pippijn |
1.2 |
* $Id: table.h,v 1.1 2007-07-19 08:24:51 pippijn Exp $ |
8 |
pippijn |
1.1 |
*/ |
9 |
|
|
|
10 |
|
|
#ifndef ATHEME_TABLE_H |
11 |
|
|
#define ATHEME_TABLE_H |
12 |
|
|
|
13 |
|
|
struct table_t |
14 |
|
|
{ |
15 |
|
|
object_t parent; |
16 |
|
|
list_t rows; |
17 |
|
|
}; |
18 |
|
|
|
19 |
|
|
struct table_row_t |
20 |
|
|
{ |
21 |
|
|
int id; |
22 |
|
|
list_t cells; |
23 |
|
|
}; |
24 |
|
|
|
25 |
|
|
struct table_cell_t |
26 |
|
|
{ |
27 |
|
|
int width; /* only if first row. */ |
28 |
|
|
char *name; |
29 |
|
|
char *value; |
30 |
|
|
}; |
31 |
|
|
|
32 |
|
|
/* |
33 |
|
|
* Creates a new table object. Use object_unref() to destroy it. |
34 |
|
|
*/ |
35 |
|
|
E table_t *table_new (const char *fmt, ...); |
36 |
|
|
|
37 |
|
|
/* |
38 |
|
|
* Renders a table, each line going to callback(). |
39 |
|
|
*/ |
40 |
|
|
E void table_render (table_t * t, void (*callback) (const char *line, void *data), void *data); |
41 |
|
|
|
42 |
|
|
/* |
43 |
|
|
* Associates a value with a row. |
44 |
|
|
*/ |
45 |
|
|
E void table_cell_associate (table_row_t * r, const char *name, const char *value); |
46 |
|
|
|
47 |
|
|
/* |
48 |
|
|
* Associates a row with a table. |
49 |
|
|
*/ |
50 |
|
|
E table_row_t *table_row_new (table_t * t); |
51 |
|
|
|
52 |
|
|
#endif |