ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/table.h
Revision: 1.4
Committed: Sun Sep 16 18:54:42 2007 UTC (16 years, 8 months ago) by pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +9 -4 lines
Log Message:
#defines to enum

File Contents

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