/* pcw_qref.txt
   pcwindows v1.1
   quick reference
   28nov91 cb
*/

/* === menu.h ======================================================== */
typedef struct menu_wnd {                /* Basic Window Definition */
       WNDPTR *wnd;                          /* initial Window Pointer */
       int    urow,ucol,lrow,lcol;                /* Window Boundaries */
       int    fcolor,bcolor;                           /* Window color */
       int    btype, bfclr,bbclr;             /* Border Type and Color */
       char   *title;                                    /* Menu Title */
       int    tvloc, thloc, tfclr, tbclr;       /* Title Loc and Color */
       int    cfclr, cbclr;                        /* Choice Bar Color */
}MENU_WND;


typedef struct p_menu_list {    /* Definition of Pmenu Option Field */
       char select_key;                       /* Select Key for Option */
       char *item;                     /* String Description of Option */
}PMNUFLDS;
typedef struct {                /* Definition of Pmenu */
       MENU_WND    pwnd;                    /* Pointer to Basic Window */
       int         bar_pos;                 /* Initial Choice Position */
       PMNUFLDS    *plist;                  /* Pointer to Option Array */
}PMNUTYPE;
WNDPTR *makepmenu(PMNUTYPE *menu);
char   pmenuinput(PMNUTYPE *menu);


typedef struct {                /* Definition of Lmenu Option Field */
       char select_key;                    /* Select Key for Option */
       int  select_col;               /* column of Menu Option Text */
       char *item;                              /* Menu Option Text */
       char *item_msg;                /* Text Description of Option */
}LMNUFLDS;
typedef struct l_menu_type {   /* Definition of Lmenu */
       MENU_WND    lwnd;               /* Pointer to Basic Windoe\w */
       int         bar_pos, wnd_pos;  /* initial Bar and Window Pos */
       LMNUFLDS    **llist;        /* Pointer to pointer to Options */
}LMNUTYPE;
WNDPTR *makelmenu(LMNUTYPE *menu);
char   lmenuinput(LMNUTYPE *menu);


typedef struct pick_list {     /* Definition of Picklist */
       MENU_WND    plwnd;                /* Pointer to Basic Window */
       char        **list;         /* Pointer to Pointer to Options */      
       int         bar_pos, off;      /* initial Bar and Window Pos */
}PICKLIST;
WNDPTR *make_pick_list(PICKLIST *menu);
int    get_pick_list(PICKLIST *menu);


typedef struct {            /* Definition of Tmenu Option Fields */
        char select_key;                              /* Select Key */
        int  select_col;              /* Column of Menu Option Text */
        char *item;                             /* Menu Option Text */
}TMNUFLDS;
typedef struct t_menu_type {  /* Definition of Tmenu */
        MENU_WND  twnd;                  /* Pointer to Basic Window */
        int       bar_pos, wnd_pos;   /* Initial Bar and Window Pos */
        TMNUFLDS  **tlist;         /* Pointer to Pointer to Options */
}TMNUTYPE;
WNDPTR *maketmenu(TMNUTYPE *menu);
char   tmenuinput(TMNUTYPE *menu);


/* === pcwproto.h =====================================  */

/* Environment functions */
void   pcwinit(int action); [AUTOEXIT|NOEXIT]        /* init library */
int    ispcwinit(void);                /* Is the library intialized? */
int    chk_video_state(int *rw, int *cl); /* Returns max rows & cols */
int    getpage(void);                       /* Gets logical CRT page */
int    getpagesize(void);                /* Returns size of CRT page */
int    setpage(int page);                   /* Sets logical CRT page */
unsigned int getscrnseg(void);       /* Returns Segment of video mem */

/*     Window Functions    */
WNDPTR *wexplode(int urow,int ucol,int lrow,int lcol,int fclr,int bclr);
WNDPTR *wframe(int ur,int uc,int lr,int lc, int fclr, int bclr);
WNDPTR *get_active_wnd(void);
WNDPTR *wpush(int urow, int ucol, int lrow, int lcol);
WNDPTR *wpop(WNDPTR *wnd);
int    whide(WNDPTR *wnd);
int    wshow(WNDPTR *wnd);
int    wndmove(WNDPTR *wnd, int row, int col);

int    wputs(WNDPTR *wnd, int row, int col, char str[]); [col=col|CENTER]
int    wprintf(WNDPTR *wnd, int row, int col, char *format,...);
int    wprints(WNDPTR *wnd,int row,int col,int fclr,int bclr,char *str);
int    w_block_write(WNDPTR *wnd, int row, int col, char *block[]);
int    wtitle(WNDPTR *wnd, int tb, int mlr, char *s);
            tb = [TOP | BOTTOM],  mlr = [MIDDLE | LEFT | RITE]
int    wscroll(WNDPTR *wnd, int action, int count);
int    clr_wnd(WNDPTR *wnd, int action);

/* Some Miscellaneous Function related to quick writes & windows */
void   titlecolor(int fcolor, int bcolor);
void   bordercolor(int fcolor, int bcolor);
void   setborder(int type);
       [DOUBLEALL | SINGLEALL | SINGLESIDES | DOUBLESIDES | NOSIDES]
void   set_wnd_attr(WNDPTR *wnd, int foreground, int background);
int    w_chg_attr(WNDPTR *wnd,int row,int col,
                  int fclr,int blclr,int cols);

/*     Quick Screen Writing Routines     */
int    qputchar(int row, int col, int fcolor, int bcolor, char ch);
int    qfill(int urow,int ucol,int lrow,int lcol,
             int fcolor,int bcolor,int ch); [ch = SPACES = ' ']
int    qbox(int urow, int ucol, int lrow, int lcol);
int    qvchar(int row,int col,int fcolor,int bcolor,char ch,int count);
int    qhchar(int row,int col,int fcolor,int bcolor,char ch,int count);
int    qputs (int row, int col, int fcolor, int bcolor, char *s);
                     [col = col | CENTER]
int    qvputs(int row, int col, int fcolor, int bcolor, char *s);
int    qprintf(int row,int col,int fcolor,int bcolor,char *format, ...);
int    qvprintf(int row,int col,int fcolor,int bcolor,char *format, ...);
int    q_block_write(int row,int col,int fclr,int bclr, char *block[]);
int    scroll(int ur,int uc,int lr,int lc,int fg,int bg,int count);
int    chg_attr(int row, int col, int fcolor, int bcolor, int count);
int    getattr(int row, int col);
int    getchr(int row, int col);

/* Miscellaneous Functions */
void   _sound(unsigned freq);
void   _nosound(void);
void   rest(unsigned ticks);
void   swait(unsigned seconds);
void far _delay(unsigned ms);
void   farcopy(void far *dest, void far *srce, unsigned count);

/* BIOS dependent functions */
int    vgetattr(void);
int    vgetchr(void);
void   get_cursor_size(int *tline, int *bline);
void   set_cursor_size(int tline, int bline);
void   get_cursor_pos(int *row, int *col);
void   set_cursor_pos(int row, int col);
void   switchpage(int page);
void   vcls(void);
void   vgetmode(int *cols, int *mode, int *activepage);
void   vsetmode(int mode);

/*  Mouse Functions  */
int    init_mouse(void);
int    get_mpressed(int button);     LEFTM  /* Left Mouse Button */
int    get_mreleased(int button);    RITEM  /* Rite Mouse Button */
void   show_mouse(void);
void   hide_mouse(void);
void   get_mpos(int *row, int *col, int *bstatus);
void   set_mpos(int  row, int  col);
void   mframe(int urow, int ucol, int lrow, int lcol);
void   set_mtype(int ctype, int arg1, int arg2);
char   *save_mouse_state(void);
void   restore_mouse_state(char *buffer);

/* Keyboard Functions */
int    keypressed(void);                        /* Was a key pressed */
int    readkey(void);                     /* Read keyboard character */
int    isxkeybd(void);                    /* Extended keyboard BIOS? */
int    keywait(int seconds);                   /* Wait or keypressed */
int    get_chars(int rw,int cl,int fc,int bc,int len,char *buffer);
char   keyin(void);                   /* Read char/handles spcl keys */
void   keybrd_flush(void);                     /* Flush the keyboard */

/*  EGA/VGA specific functions */
int    download_rom_font(int font, char *buffer);
int    load_user_font(int bpc,int blk,int nchars,int fchar,char *buffer);
char   *get_ega_palette(int mode);
void   set_palette(int preg, int color);
void   load_ega_palette(void);
void   set_load_palette(int preg, int color);
void   fload(int block, int font);
void   set_vga_scan_lines(int arg);

/* Interrupt Handlers & Such */
int    set_int24(void);
int    set_int29(void);
void   reset_int29(void);

/*  Defined Text Colors  */
   BLACK, BLUE, GREEN, CYAN
   RED, MAGENTA, BROWN, LIGHTGRAY
   DARKGRAY, LIGHTBLUE, LIGHTGREEN, LIGHTCYAN
   LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE
   BLINK

/*  Defined Keys  */
   CR, ESC, F1..F10, SHFTF1..10, CTRLF1..F10, ALTF1..F10 
   BACKSPACE, TAB, SHFTTAB, HOME, UPARROW, PGUP, LEFTARROW
   RITEARROW, END, DOWNARROW, PGDN, INS, DEL

