home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name wnremove -- Remove window from screen.
- *
- * Synopsis presult = wnremove(pwindow);
- *
- * BWINDOW *presult Pointer to newly-removed BWINDOW
- * structure, or NIL if failure.
- * BWINDOW *pwindow Pointer to BWINDOW structure to
- * remove.
- *
- * Description This function removes a window that is currently
- * displayed and restores the previous contents of the
- * screen.
- *
- * An error occurs if pwin does not point to a valid window
- * structure, or if the window has been designated "not
- * removable", or if the window is not currently displayed.
- *
- * Use WNFORGET to detach a non-removable window from the
- * video display page where it is displayed.
- *
- * Returns presult Pointer to newly-removed BWINDOW
- * structure, or NIL if failure.
- * *pwindow Several fields altered.
- * b_pactnode[][] Window node with active cursor.
- * b_wnerr Possible values:
- * (No change) Success.
- * WN_BAD_WIN *pwin is invalid.
- * WN_NOT_SHOWN Not currently shown.
- * WN_CANT_HIDE Not removable.
- * WN_BAD_NODE Internal error.
- * WN_BAD_DEV Internal error.
- * WN_BAD_PAGE Internal error.
- * WN_ILL_DIM Internal error.
- * WN_NULL_PTR Internal error.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1986
- *
- **/
-
- #include <bwindow.h>
-
- BWINDOW *wnremove(pwindow)
- BWINDOW *pwindow;
- {
- if (wnvalwin(pwindow) == NIL) /* Validate window pointer. */
- {
- wnerror(WN_BAD_WIN);
- return NIL;
- }
- if ( pwindow->where_shown.dev != COLOR /* Ensure it's showing. */
- && pwindow->where_shown.dev != MONO)
- {
- wnerror(WN_NOT_SHOWN);
- return NIL;
- }
-
- if (NIL == wnhide(pwindow)) /* Remove from physical screen. */
- return NIL;
-
- if (NIL == wnpgrem(pwindow)) /* Remove from linked list. */
- return NIL;
-
- pwindow->where_shown.dev = /* Mark as not shown. */
- pwindow->where_prev.dev = ABSENT;
- pwindow->options.hidden = 0;
-
- if (b_pcurwin == pwindow) /* If this window is current, */
- b_pcurwin = NIL; /* mark no window as current. */
-
- return pwindow; /* Success. */
- }