home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c005 / 5.ddi / C / WNREMOVE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-05  |  2.2 KB  |  74 lines

  1. /**
  2. *
  3. * Name        wnremove -- Remove window from screen.
  4. *
  5. * Synopsis    presult = wnremove(pwindow);
  6. *
  7. *        BWINDOW *presult  Pointer to newly-removed BWINDOW
  8. *                  structure, or NIL if failure.
  9. *        BWINDOW *pwindow  Pointer to BWINDOW structure to
  10. *                  remove.
  11. *
  12. * Description    This function removes a window that is currently
  13. *        displayed and restores the previous contents of the
  14. *        screen.
  15. *
  16. *        An error occurs if pwin does not point to a valid window
  17. *        structure, or if the window has been designated "not
  18. *        removable", or if the window is not currently displayed.
  19. *
  20. *        Use WNFORGET to detach a non-removable window from the
  21. *        video display page where it is displayed.
  22. *
  23. * Returns    presult       Pointer to newly-removed BWINDOW
  24. *                  structure, or NIL if failure.
  25. *        *pwindow      Several fields altered.
  26. *        b_pactnode[][]      Window node with active cursor.
  27. *        b_wnerr       Possible values:
  28. *                  (No change)       Success.
  29. *                  WN_BAD_WIN       *pwin is invalid.
  30. *                  WN_NOT_SHOWN       Not currently shown.
  31. *                  WN_CANT_HIDE       Not removable.
  32. *                  WN_BAD_NODE       Internal error.
  33. *                  WN_BAD_DEV       Internal error.
  34. *                  WN_BAD_PAGE       Internal error.
  35. *                  WN_ILL_DIM       Internal error.
  36. *                  WN_NULL_PTR       Internal error.
  37. *
  38. * Version    3.0  (C)Copyright Blaise Computing Inc. 1986
  39. *
  40. **/
  41.  
  42. #include <bwindow.h>
  43.  
  44. BWINDOW *wnremove(pwindow)
  45. BWINDOW *pwindow;
  46. {
  47.     if (wnvalwin(pwindow) == NIL)     /* Validate window pointer.     */
  48.     {
  49.     wnerror(WN_BAD_WIN);
  50.     return NIL;
  51.     }
  52.     if (   pwindow->where_shown.dev != COLOR  /* Ensure it's showing. */
  53.     && pwindow->where_shown.dev != MONO)
  54.     {
  55.     wnerror(WN_NOT_SHOWN);
  56.     return NIL;
  57.     }
  58.  
  59.     if (NIL == wnhide(pwindow))       /* Remove from physical screen. */
  60.     return NIL;
  61.  
  62.     if (NIL == wnpgrem(pwindow))      /* Remove from linked list.     */
  63.     return NIL;
  64.  
  65.     pwindow->where_shown.dev =          /* Mark as not shown.          */
  66.     pwindow->where_prev.dev  = ABSENT;
  67.     pwindow->options.hidden  = 0;
  68.  
  69.     if (b_pcurwin == pwindow)          /* If this window is current,   */
  70.     b_pcurwin = NIL;          /* mark no window as current.   */
  71.  
  72.     return pwindow;              /* Success.              */
  73. }
  74.