outopts.c 4.1 KB

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