Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /* PDCurses */
  2.  
  3. #include <curspriv.h>
  4.  
  5. /*man-start**************************************************************
  6.  
  7. outopts
  8. -------
  9.  
  10. ### Synopsis
  11.  
  12.     int clearok(WINDOW *win, bool bf);
  13.     int idlok(WINDOW *win, bool bf);
  14.     void idcok(WINDOW *win, bool bf);
  15.     void immedok(WINDOW *win, bool bf);
  16.     int leaveok(WINDOW *win, bool bf);
  17.     int setscrreg(int top, int bot);
  18.     int wsetscrreg(WINDOW *win, int top, int bot);
  19.     int scrollok(WINDOW *win, bool bf);
  20.  
  21.     int raw_output(bool bf);
  22.  
  23.     bool is_leaveok(const WINDOW *win);
  24.  
  25. ### Description
  26.  
  27.    With clearok(), if bf is TRUE, the next call to wrefresh() with this
  28.    window will clear the screen completely and redraw the entire screen.
  29.  
  30.    immedok(), called with a second argument of TRUE, causes an automatic
  31.    wrefresh() every time a change is made to the specified window.
  32.  
  33.    Normally, the hardware cursor is left at the location of the window
  34.    being refreshed. leaveok() allows the cursor to be left wherever the
  35.    update happens to leave it. It's useful for applications where the
  36.    cursor is not used, since it reduces the need for cursor motions. If
  37.    possible, the cursor is made invisible when this option is enabled.
  38.  
  39.    wsetscrreg() sets a scrolling region in a window; "top" and "bot" are
  40.    the line numbers for the top and bottom margins. If this option and
  41.    scrollok() are enabled, any attempt to move off the bottom margin
  42.    will cause all lines in the scrolling region to scroll up one line.
  43.    setscrreg() is the stdscr version.
  44.  
  45.    idlok() and idcok() do nothing in PDCurses, but are provided for
  46.    compatibility with other curses implementations.
  47.  
  48.    raw_output() enables the output of raw characters using the standard
  49.    *add* and *ins* curses functions (that is, it disables translation of
  50.    control characters).
  51.  
  52.    is_leaveok() reports whether the specified window is in leaveok mode.
  53.  
  54. ### Return Value
  55.  
  56.    All functions except is_leaveok() return OK on success and ERR on
  57.    error.
  58.  
  59. ### Portability
  60.                              X/Open  ncurses  NetBSD
  61.     clearok                     Y       Y       Y
  62.     idlok                       Y       Y       Y
  63.     idcok                       Y       Y       Y
  64.     immedok                     Y       Y       Y
  65.     leaveok                     Y       Y       Y
  66.     setscrreg                   Y       Y       Y
  67.     wsetscrreg                  Y       Y       Y
  68.     scrollok                    Y       Y       Y
  69.     is_leaveok                  -       Y       Y
  70.     raw_output                  -       -       -
  71.  
  72. **man-end****************************************************************/
  73.  
  74. int clearok(WINDOW *win, bool bf)
  75. {
  76.     PDC_LOG(("clearok() - called\n"));
  77.  
  78.     if (!win)
  79.         return ERR;
  80.  
  81.     win->_clear = bf;
  82.  
  83.     return OK;
  84. }
  85.  
  86. int idlok(WINDOW *win, bool bf)
  87. {
  88.     PDC_LOG(("idlok() - called\n"));
  89.  
  90.     return OK;
  91. }
  92.  
  93. void idcok(WINDOW *win, bool bf)
  94. {
  95.     PDC_LOG(("idcok() - called\n"));
  96. }
  97.  
  98. void immedok(WINDOW *win, bool bf)
  99. {
  100.     PDC_LOG(("immedok() - called\n"));
  101.  
  102.     if (win)
  103.         win->_immed = bf;
  104. }
  105.  
  106. int leaveok(WINDOW *win, bool bf)
  107. {
  108.     PDC_LOG(("leaveok() - called\n"));
  109.  
  110.     if (!win)
  111.         return ERR;
  112.  
  113.     win->_leaveit = bf;
  114.  
  115.     curs_set(!bf);
  116.  
  117.     return OK;
  118. }
  119.  
  120. int setscrreg(int top, int bottom)
  121. {
  122.     PDC_LOG(("setscrreg() - called: top %d bottom %d\n", top, bottom));
  123.  
  124.     return wsetscrreg(stdscr, top, bottom);
  125. }
  126.  
  127. int wsetscrreg(WINDOW *win, int top, int bottom)
  128. {
  129.     PDC_LOG(("wsetscrreg() - called: top %d bottom %d\n", top, bottom));
  130.  
  131.     if (win && 0 <= top && top <= win->_cury &&
  132.         win->_cury <= bottom && bottom < win->_maxy)
  133.     {
  134.         win->_tmarg = top;
  135.         win->_bmarg = bottom;
  136.  
  137.         return OK;
  138.     }
  139.     else
  140.         return ERR;
  141. }
  142.  
  143. int scrollok(WINDOW *win, bool bf)
  144. {
  145.     PDC_LOG(("scrollok() - called\n"));
  146.  
  147.     if (!win)
  148.         return ERR;
  149.  
  150.     win->_scroll = bf;
  151.  
  152.     return OK;
  153. }
  154.  
  155. int raw_output(bool bf)
  156. {
  157.     PDC_LOG(("raw_output() - called\n"));
  158.  
  159.     if (!SP)
  160.         return ERR;
  161.  
  162.     SP->raw_out = bf;
  163.  
  164.     return OK;
  165. }
  166.  
  167. bool is_leaveok(const WINDOW *win)
  168. {
  169.     PDC_LOG(("is_leaveok() - called\n"));
  170.  
  171.     if (!win)
  172.         return FALSE;
  173.  
  174.     return win->_leaveit;
  175. }
  176.