home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
INCLUDE
/
MENUDECL.H
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-07
|
12KB
|
361 lines
/*
menudecl.h
% public header for menu object
written by stephen ng.
C-scape 3.2
Copyright (c) 1986-1988, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
11/16/86 sng Changed some functions for variable-length fields.
12/18/86 jmd Removed some extraneous comments and modified
for new textbuf.
6/06/87 jmd Added check for bad field numbers (later removed).
8/20/87 jmd Added prototyping for functions without arguments
9/01/87 jmd added NO_PROTO option
11/19/87 jmd Got rid of menu_GetFieldFuncs
4/10/88 jmd Got rid of menu_GetSize, added some macros
added field moves and deletes
4/11/88 jmd added scrollable fields
4/30/88 jmd added buffer data to menu struct
5/09/88 jdc added parens to some macros
5/11/88 jmd added push/pull field funcs
6/23/88 jmd removed menu generic data pointer
6/24/88 jmd converted to new xarray/iarray calls
6/28/88 jdc put #define DEF_COLOR in tbdecl.h
8/20/88 jmd add list of screen objects
8/23/88 jmd removed some TB commands and changed others
added virtual size and dirty bit.
8/25/88 jdc added -1 to menu_GetFieldLastCol()
9/19/88 jmd added field name support
9/28/88 jmd added menu create data
10/05/88 jmd added sedptr to menu
11/05/88 jmd added menu_Destroy, removed menu_Close and sedptr
11/28/88 jmd reorganized headers
12/11/88 jmd moved Find funcs to menupriv
12/14/88 jmd field_get is now menu_GetField
12/15/88 jmd added sedptr to menu (i mean it this time)
2/08/89 jdc changed menu_MarkField to menu_SetMark (like field_SetMark)
and added real menu_MarkField() (like sed_MarkField())
3/27/89 jdc added the menu_GetSed() macro
3/31/89 jmd added the menu_GetTextbuf() macro
4/24/89 jdc added funcnamea for LNF
9/11/89 jmd increased NAME_MAXLEN
12/10/89 jmd made create data private to menu.c
12/11/89 jmd added field hilite macros
1/21/89 jdc changed oslist macro (oslist_DelSym)
3/28/90 jmd ansi-fied
8/22/90 jdc made menu_RemoveName a function
9/07/90 jmd renamed oslist funcs
*/
#define PCT_BUF_LEN 511 /* size of the percent buffer */
#define NAME_MAXLEN 30 /* maximum size of a field name */
/* The menu type */
typedef struct menu_struct {
/* menu data */
int rowcount; /* number of rows */
int colcount; /* number of columns */
unsigned dirty:1; /* size dirty bit */
int vheight; /* virtual height */
int vwidth; /* virtual width */
tb_type textbuf; /* text buffer */
xarray fa; /* field xarray */
int fieldcount; /* number of fields */
iarray fgrid; /* array of field rows */
iarray boba; /* bob iarray */
int bobcount; /* number of bob objects*/
int frowcount; /* field rowcount */
oslist_type namelist; /* field name list */
oslist_type dptrlist; /* field data pointer list */
VOID *varblock; /* pointer to var memory */
obj_type sedptr; /* pointer to parent sed */
/* state info for building the menu with menu_Printf */
int mp_count; /* number of times menu_Printf
called (for error messages) */
int row; /* current location */
int col;
byte color; /* current color */
byte old_color; /* last color used */
/* buffers used by the menu */
char *token_buf; /* the token (& scratch) buffer */
int token_size; /* size of the token buffer */
VOID *create; /* creation data (a menu_create struct *) */
iarray funcnamea; /* handles to function names for LNF */
iarray varnamea; /* handles to varible names for LNF */
iarray functypea; /* handles to function types for LNF */
} *menu_type;
/* -------------------------------------------------------------------------- */
/* function prototypes */
extern boolean menu_Printf(menu_type menu, char *string, ...);
/* MENU.C */
extern menu_type menu_Open(void);
extern void menu_Flush(menu_type menu);
extern field_type menu_GetField(menu_type menu, int fld);
/* MENUCFLD.C */
extern int menu_CopyField(menu_type dmenu, int row, int col, menu_type smenu, int fldno);
/* MENUDEST.C */
extern void menu_Destroy(menu_type menu);
/* MENUDFLD.C */
extern void menu_DeleteField(menu_type menu, int fieldno);
/* MENUDROW.C */
extern void menu_DeleteRows(menu_type menu, int row, int count);
/* MENUIROW.C */
extern boolean menu_InsertRows(menu_type menu, int row, int count);
/* MENUMFLD.C */
extern void menu_MoveField(menu_type menu, int fieldno, int row, int col);
/* MENUMRKF.C */
extern void menu_MarkField(menu_type menu, int fieldno, char reg, char sel);
/* MENUNAME.C */
extern int menu_AddName(menu_type menu, char *name, int fieldno);
extern void menu_SetFieldName(menu_type menu, int fieldno, char *name);
extern int menu_GetNameNo(menu_type menu, char *name);
extern boolean menu_RemoveFieldName(menu_type menu, int fld);
/* MENUPDPL.C */
extern char *menu_PutDPL(menu_type menu, char *s);
/* MENUPUTB.C */
extern boolean menu_putTB(menu_type menu,int row,int col,char *text,char chr,unsigned slen,byte color,byte old_color,int mode);
extern menu_type menu_ClearTB(menu_type menu);
/* MENUSFB.C */
extern boolean menu_SetFieldBob(menu_type menu, int fld, bob_type bob);
/* MENUSFLD.C */
extern void menu_SwapFields(menu_type menu, int fieldno_1, int fieldno_2);
/* MENUSIZE.C */
extern void menu_RecalcSize(menu_type menu);
/* MENUSORT.C */
extern void menu_Sort(menu_type menu);
/* MENUTB.C */
extern boolean menu_SetTB(menu_type menu, char *text, unsigned len);
/* MENUVARS.C */
extern SIZE_T menu_GetVarSize(menu_type menu, int fld);
/* MENUXFLD.C */
extern void menu_ExchangeFields(menu_type menu, int f1, int f2);
/* -------------------------------------------------------------------------- */
/* macros */
/* For 2.0 compatibility */
#define menu_Close(menu)
#define menu_GetFieldBox(menu, fldno, box) \
field_GetBox(menu_GetField(menu, fldno), box)
#define menu_GetFieldRecord(menu, fieldno) \
field_GetRecord(menu_GetField(menu, fieldno))
#define menu_GetDataCount(menu, fieldno) \
field_GetDataCount(menu_GetField(menu, fieldno))
#define menu_GetRecordLen(menu, fieldno) \
field_GetRecordLen(menu_GetField(menu, fieldno))
#define menu_GetMergeLen(menu, fieldno) \
field_GetMergeLen(menu_GetField(menu, fieldno))
#define menu_GetFuncs(menu, fieldno) \
field_GetFuncs(menu_GetField(menu, fieldno))
#define menu_GetVar(menu, fieldno) \
field_GetVar(menu_GetField(menu, fieldno))
#define menu_GetFieldMerge(menu, fieldno) \
field_GetMerge(menu_GetField(menu, fieldno))
#define menu_GetFieldRow(menu, fieldno) \
field_GetRow(menu_GetField(menu, fieldno))
#define menu_GetFieldCol(menu, fieldno) \
field_GetCol(menu_GetField(menu, fieldno))
#define menu_GetFieldWidth(menu, fieldno) \
field_GetWidth(menu_GetField(menu, fieldno))
#define menu_GetFieldLastCol(menu, fieldno) \
(field_GetLastCol(menu_GetField(menu, fieldno)))
#define menu_GetFieldXoffset(menu, fieldno) \
field_GetXoffset(menu_GetField(menu, fieldno))
#define menu_GetFieldRight(menu, fieldno) \
field_GetRight(menu_GetField(menu, fieldno))
#define menu_GetFieldLeft(menu, fieldno) \
field_GetLeft(menu_GetField(menu, fieldno))
#define menu_GetGRow(menu, row) \
(ia_Get((menu)->fgrid, row))
#define menu_GetFieldGCol(menu, fieldno) \
field_GetGCol(menu_GetField(menu, fieldno))
#define menu_GetFieldData(menu, fieldno, datano) \
field_GetData(menu_GetField(menu, fieldno), datano)
#define menu_GetNextFieldPos(menu, fieldno, fieldpos) \
field_NextChar(menu_GetField(menu, fieldno), fieldpos)
#define menu_GetPrevFieldPos(menu, fieldno, fieldpos) \
field_PrevChar(menu_GetField(menu, fieldno), fieldpos)
#define menu_GetFirstFieldPos(menu, fieldno) \
field_FirstChar(menu_GetField(menu, fieldno))
#define menu_GetLastFieldPos(menu, fieldno) \
field_LastChar(menu_GetField(menu, fieldno))
#define menu_IsProtected(menu, fieldno) \
field_GetProtected(menu_GetField(menu, fieldno))
#define menu_IsMarked(menu, fieldno) \
field_GetMarked(menu_GetField(menu, fieldno))
#define menu_IsHiCharOn(menu, fieldno) \
field_IsHiCharOn(menu_GetField(menu, fieldno))
#define menu_GetFieldRegAttr(menu, fieldno) \
field_GetRegAttr(menu_GetField(menu, fieldno))
#define menu_GetFieldSelAttr(menu, fieldno) \
field_GetSelAttr(menu_GetField(menu, fieldno))
#define menu_GetR2M(menu, fieldno, fieldpos) \
field_GetR2M(menu_GetField(menu, fieldno), fieldpos)
#define menu_GetFieldCount(menu) ((menu)->fieldcount)
#define menu_GetRow(menu) ((menu)->row)
#define menu_GetCol(menu) ((menu)->col)
#define menu_GetTextbuf(menu) ((menu)->textbuf)
#define menu_SetChar(menu, fieldno, fieldpos, c) \
field_SetChar(menu_GetField(menu, fieldno), fieldpos, (char) c)
#define menu_SetRecord(menu, fieldno, s) \
field_SetString(menu_GetField(menu, (fieldno)), s)
#define menu_SetVar(menu, fieldno, var) \
field_SetVar(menu_GetField(menu, fieldno), var)
#define menu_SetFuncs(menu, fieldno, funcs) \
field_SetFuncs(menu_GetField(menu, fieldno), funcs)
#define menu_SetFieldData(menu, fieldno, datano, data) \
field_SetData(menu_GetField(menu, fieldno), datano, data)
#define menu_ProtectField(menu, fieldno, flag) \
field_SetProtected(menu_GetField(menu, fieldno), flag)
#define menu_SetHiChar(menu, fieldno, no) \
field_SetHiChar(menu_GetField(menu, fieldno), no)
#define menu_GetHiChar(menu, fieldno) \
field_GetHiChar(menu_GetField(menu, fieldno))
#define menu_SetMark(menu, fieldno, flag) \
field_SetMarked(menu_GetField(menu, fieldno), flag)
#define menu_GetScratchPad(menu) ((menu)->token_buf)
#define menu_GetScratchSize(menu) ((menu)->token_size)
#define menu_PullLeft(menu, fieldno, fpos) \
field_PullLeft(menu_GetField(menu, fieldno), fpos)
#define menu_PullRight(menu, fieldno, fpos) \
field_PullRight(menu_GetField(menu, fieldno), fpos)
#define menu_PushLeft(menu, fieldno, fpos, x) \
field_PushLeft(menu_GetField(menu, fieldno), fpos, x)
#define menu_PushRight(menu, fieldno, fpos, x) \
field_PushRight(menu_GetField(menu, fieldno), fpos, x)
#define menu_SetDirty(menu, d) ((menu)->dirty = (d))
#define menu_IsDirty(menu) ((menu)->dirty)
#define menu_GetRowCount(menu) \
(((menu)->rowcount > (menu)->frowcount) ? (menu)->rowcount : (menu)->frowcount)
#define menu_GetColCount(menu) \
((menu)->colcount)
#define menu_GetHeight(menu) \
(menu_IsDirty(menu) ? (menu_RecalcSize(menu), menu_GetRowCount(menu)) : menu_GetRowCount(menu))
#define menu_GetWidth(menu) \
(menu_IsDirty(menu) ? (menu_RecalcSize(menu), menu_GetColCount(menu)) : menu_GetColCount(menu))
#define menu_GetWrapWidth(menu) tb_GetWrapWidth((menu)->textbuf)
#define menu_SetWrapWidth(menu, w) \
(tb_SetWrapWidth((menu)->textbuf, (w)), menu_SetDirty(menu, TRUE))
#define menu_GetTabSize(menu) tb_GetTabSize((menu)->textbuf)
#define menu_SetTabSize(menu, t) \
(tb_SetTabSize((menu)->textbuf, (t)), menu_SetDirty(menu, TRUE))
#define menu_GetSed(menu) (sed_type)(menu->sedptr)
/* name macros */
#define menu_GetFieldNameNo(menu, fieldno) \
field_GetNameNo(menu_GetField(menu, fieldno))
#define menu_SetFieldNameNo(menu, fieldno, nameno) \
field_SetNameNo(menu_GetField(menu, fieldno), nameno)
#define menu_GetFieldName(m, f) \
oslist_GetSym((m)->namelist, menu_GetFieldNameNo(m, f))
#define menu_CloseNameList(m) oslist_Close((m)->namelist)
/* bob macros */
#define menu_GetFieldBob(menu, fldno) field_GetBob(menu_GetField(menu, fldno))
/* LNF macros */
#define menu_SetFuncNameA(menu, a) (menu->funcnamea = (a))
#define menu_GetFuncNameA(menu) (menu->funcnamea)