home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / cprog / cursesp.zip / SCRREG.C < prev    next >
C/C++ Source or Header  |  1991-12-02  |  2KB  |  56 lines

  1. /****************************************************************/
  2. /* Wsetscrreg() routine of the PCcurses package                 */
  3. /*                                                              */
  4. /****************************************************************/
  5. /* This version of curses is based on ncurses, a curses version */
  6. /* originally written by Pavel Curtis at Cornell University.    */
  7. /* I have made substantial changes to make it run on IBM PC's,  */
  8. /* and therefore consider myself free to make it public domain. */
  9. /*              Bjorn Larsson (...mcvax!enea!infovax!bl)        */
  10. /****************************************************************/
  11. /* 1.0: Release:                                        870515  */
  12. /* 1.2: Max limits off by 1. Fixed thanks to S. Creps:  881002  */
  13. /* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes:            881005  */
  14. /****************************************************************/
  15.  
  16. #include <curses.h>
  17. #include <curspriv.h>
  18.  
  19. char _curses_scrreg_rcsid[] = "@(#)scrreg.c v1.3 - 881005";
  20.  
  21. /****************************************************************/
  22. /* Wsetscrreg() set the scrolling region of window 'win' to in- */
  23. /* clude all lines between 'top' and 'bottom'.                  */
  24. /****************************************************************/
  25.  
  26. int wsetscrreg(WINDOW *win, int top, int bottom)
  27.   {
  28.   if (  (0 <= top)
  29.         &&
  30.         (top <= win->_cury)
  31.         &&
  32.         (win->_cury <= bottom)
  33.         &&
  34.         (bottom < win->_maxy)
  35.      )
  36.     {
  37.     win->_regtop = top;
  38.     win->_regbottom = bottom;
  39.     return(OK);
  40.     } /* if */
  41.   else
  42.     return(ERR);
  43.   } /* wsetscrreg */
  44.  
  45. /****************************************************************/
  46. /* Setscrreg() set the scrolling region of stdscr to include    */
  47. /* all lines between 'top' and 'bottom'.                        */
  48. /****************************************************************/
  49.  
  50. int setscrreg(top, bottom)
  51.   int top;
  52.   int bottom;
  53.   {
  54.   return(wsetscrreg(stdscr,top,bottom));
  55.   } /* setscrreg */
  56.