1 /****************************************************************************** 2 * tablewidget.h -- table widget header file 3 * 4 * by Marco Trillo 5 * 6 * This source code is under public domain. 7 * 8 * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY, 9 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 10 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 11 * THE AUTHORS SHALL NOT BE HELD LIABLE FOR ANY DAMAGE TO YOU, YOUR 12 * COMPUTER, OR TO ANYONE OR ANYTHING ELSE, THAT MAY RESULT FROM ITS USE, 13 * OR MISUSE. BASICALLY, YOU USE IT AT YOUR OWN RISK. 14 ******************************************************************************/ 15 16 #ifndef __TABLEWIDGET_H 17 #define __TABLEWIDGET_H 1 18 19 #include <stdio.h> /* for FILE* */ 20 21 #define TABLE_BUFFER_SIZE 128 22 23 enum TableAlign { 24 TABLE_LEFT_ALIGN, 25 TABLE_RIGHT_ALIGN 26 }; 27 28 typedef void (*TableCallback) (int, int, int, char *); 29 30 /* Themes */ 31 enum TableThemes { 32 TABLE_THEME_CLASSIC, 33 TABLE_THEME_STRONG, 34 TABLE_THEME_BOXED 35 }; 36 typedef enum TableThemes WTheme; 37 38 struct struct_table { 39 int id; 40 int rows; 41 int cols; 42 int len; 43 int align; 44 int spacer; 45 char *caption; 46 TableCallback callback; 47 WTheme theme; 48 FILE *stream; 49 }; 50 51 typedef struct struct_table WTable; 52 53 /* Errors */ 54 55 enum TableErrors { 56 TABLE_ERR_NOTABLE, 57 TABLE_ERR_INVALID, 58 TABLE_ERR_NOCALLBACK, 59 TABLE_OK 60 }; 61 62 int 63 TableSetOptions(WTable * table, int ID, int rows, int cols, int len, 64 int spacer, int align); 65 66 int TableInitCallback(WTable * table, TableCallback callback); 67 68 int TableSetOutput(WTable * table, FILE * stream); 69 70 int TableUseTheme(WTable * table, WTheme theme); 71 72 int TableSetCaption(WTable * table, char *caption); 73 74 int DrawTable(WTable table); 75 76 /* 77 * @EOF@ -- revised February 26 2006 78 */ 79 80 #endif 81 82