home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / c / pcw_c.zip / WSCROLL.C < prev    next >
Text File  |  1990-07-25  |  2KB  |  45 lines

  1. /***************************************************************/
  2. /* File Id.                     Wscroll.C                      */
  3. /* Author.                      Stan Milam.                    */
  4. /* Date Written.                                               */
  5. /*                                                             */
  6. /*             (c) Copyright 1989-90 by Stan Milam             */
  7. /*                                                             */
  8. /* Comments:  Scroll the contents of the window count times.   */
  9. /* If count is < 0 scrolling will be up and down if positive.  */
  10. /* If the action flag is non-zero scrolling will be inside of  */
  11. /* the borders.                                                */
  12. /***************************************************************/
  13.  
  14. #include <stdio.h>
  15. #include "pcw.i"
  16. #include "pcwproto.h"
  17.  
  18. int wscroll(WNDPTR *wnd, int action, int count) {
  19.  
  20.    int ur, uc, lr, lc, fg, bg;              /* Scratch variables */
  21.    int cp, rc, mr, mc;                      /* Current Page & return code */
  22.  
  23.    if (!chk_video_state(&mr, &mc)) return(0);
  24.    if (!wnd) return(0);
  25.    if (wnd->hideflag) return(0);            /* Can't scroll if no visible */
  26.  
  27.    ur = wnd->urow;                          /* Get rows & cols from window */
  28.    uc = wnd->ucol;                          /* Structure */
  29.    lr = wnd->lrow;
  30.    lc = wnd->lcol;
  31.    if (action) {                            /* If action non-zero */
  32.       ur++; uc++;                           /* scroll inside of the borders */
  33.       lr--; lc--;
  34.    }
  35.    fg = wnd->attr & 0x0f;                   /* Retrieve the colors */
  36.    bg = (wnd->attr & 0xf0) >> 4;
  37.  
  38.    cp = getpage();                          /* Save the current page*/
  39.    setpage(wnd->page);                      /* Video Page window is in */
  40.    re_order(wnd,NORMAL);                    /* Make the window active */
  41.    rc = scroll(ur,uc,lr,lc,fg,bg,count);    /* Call scroll function */
  42.    setpage(cp);                             /* Reset video page */
  43.    return(rc);                              /* Send back return code */
  44. }
  45.