home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / CURSES.LZH / SCRREG.C < prev    next >
C/C++ Source or Header  |  1980-01-01  |  2KB  |  59 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(win, top, bottom)
  27.   WINDOW    *win;
  28.   int         top;
  29.   int         bottom;
  30.   {
  31.   if (  (0 <= top)
  32.     &&
  33.     (top <= win->_cury)
  34.     &&
  35.     (win->_cury <= bottom)
  36.     &&
  37.     (bottom < win->_maxy)
  38.      )
  39.     {
  40.     win->_regtop = top;
  41.     win->_regbottom = bottom;
  42.     return(OK);
  43.     } /* if */
  44.   else
  45.     return(ERR);
  46.   } /* wsetscrreg */
  47.  
  48. /****************************************************************/
  49. /* Setscrreg() set the scrolling region of stdscr to include    */
  50. /* all lines between 'top' and 'bottom'.            */
  51. /****************************************************************/
  52.  
  53. int setscrreg(top, bottom)
  54.   int top;
  55.   int bottom;
  56.   {
  57.   return(wsetscrreg(stdscr,top,bottom));
  58.   } /* setscrreg */
  59.