summaryrefslogtreecommitdiffstats
path: root/include/visio.h
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-16 01:08:07 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-16 01:08:07 +0800
commita38ce8fbc7b7b18ad75f86278fe25fd85ba485d2 (patch)
tree5a227cdba379a203155bbaf91b8b2323a2130a3c /include/visio.h
parentdb9187feb31e50ed2fbe78f7fd73bf8d37bf0edc (diff)
downloadpttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.tar
pttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.tar.gz
pttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.tar.bz2
pttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.tar.lz
pttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.tar.xz
pttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.tar.zst
pttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.zip
- (internal) visio: add columned output API.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4170 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'include/visio.h')
-rw-r--r--include/visio.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/visio.h b/include/visio.h
index 986be0df..af8cf4dd 100644
--- a/include/visio.h
+++ b/include/visio.h
@@ -9,6 +9,7 @@
#include "bbs.h"
#include "ansi.h" // we need it.
+#include <limits.h>
// THEME DEFINITION ----------------------------------------------------
#define VCLR_HEADER ANSI_COLOR(1;37;46) // was: TITLE_COLOR
@@ -30,10 +31,28 @@
#define VMSG_HDR_PREFIX "Ħi "
#define VMSG_HDR_POSTFIX " Ħj"
+// CONSTANT DEFINITION -------------------------------------------------
+#define VCOL_ALIGN_LEFT (0)
+#define VCOL_ALIGN_RIGHT (1)
+// #define VCOL_ALIGN_MIDDLE (2)
+#define VCOL_MAXW (INT16_MAX)
+
// DATATYPE DEFINITION -------------------------------------------------
typedef void * VREFSCR;
typedef long VREFCUR;
+typedef short VCOLW;
+typedef struct {
+ char *caption;
+ char *attr; // default attribute
+ VCOLW minw; // minimal width
+ VCOLW maxw; // max width
+ char has_ansi; // support ANSI escape sequence
+ char align; // alignment
+ char usewhole; // draw entire column, not leaving borders
+ char flag; // reserved
+} VCOL;
+
// API DEFINITION ----------------------------------------------------
// int vans(char *prompt); // prompt at bottom and return y/n in lower case.
// void vs_bar(char *title); // like stand_title
@@ -56,6 +75,11 @@ void vs_header (const char *title, const char *mid, const char *right); // vs_
void vs_hdr (const char *title); // vs_bar, stand_title
void vs_footer (const char *caption, const char *prompt);
+// columned output
+void vs_cols_layout (const VCOL* cols, VCOLW *ws, int n);
+void vs_cols_hdr (const VCOL* cols, const VCOLW *ws, int n);
+void vs_cols (const VCOL* cols, const VCOLW *ws, int n, ...);
+
// compatible macros
#define stand_title vs_hdr