home *** CD-ROM | disk | FTP | other *** search
- /*
- winlist.c 1/20/88
-
- % Window list management functions
- by Ted.
-
- Note: these functions do not explicitly protect themselves for reentrancy
- because we assume they will only be called from functions which already do.
-
- OWL 1.1
- Copyright (c) 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 3/10/88 Ted rewrote for the window function/data pointer concept.
- All 'iwind's removed to higher level text-window objects
- 3/22/88 Ted Installed linked windows handling.
- 5/02/88 Ted Added list head window concept.
- 8/15/88 jmd added arg to dwmgr_CreateWin
- 10/31/88 Ted: Removed linked windows handling.
- 4/12/89 ted Made ListClose unlink windows because of complications
- arising when a parent closes its children in shutting down.
- 8/12/89 jdc added win_Close trickery in wmgr_ListClose
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
-
- OSTATIC void OWLPRIV linkin(_arg3(win_type, win_type, win_type));
- /* -------------------------------------------------------------------------- */
-
- win_type OWLPRIV wmgr_ListOpen()
- /*
- Open a window list by opening a list head window.
- */
- {
- winopendata_struct wod;
- opbox zbox;
-
- zbox.xmin = zbox.xmax = zbox.ymin = zbox.ymax = 0;
- wod.boxp = &zbox;
- wod.font = NULL;
- wod.list = NULL;
-
- return(win_OpenRaw(npwin_Class, &wod));
- }
- /* -------------------------------------------------------------------------- */
-
- void OWLPRIV wmgr_ListClose(listtop)
- win_type listtop;
- /*
- Close a window list by closing all windows in it, including the list head.
- */
- {
- win_type twin;
-
- for (twin = win_GetBelow(listtop); twin != NULL; twin = win_GetBelow(listtop)) {
- win_setemployed(twin, FALSE); /* trick win_Close */
- win_Close(twin);
- }
- obj_Close(listtop);
- }
- /* -------------------------------------------------------------------------- */
-
- void OWLPRIV win_ListAdd(listtop, win)
- win_type listtop, win;
- /*
- Adds 'win' to list below 'listtop'.
- 'win' must be unattached.
- */
- {
- if (listtop == NULL) return; /* Error */
- if (win == NULL) return; /* Error */
- if (win_GetAbove(win) != NULL) return; /* Error - 'win' must be fresh */
-
- linkin(listtop, win, win);
- }
- /* -------------------------------------------------------------------------- */
-
- void OWLPRIV win_ListRemove(win)
- win_type win;
- /*
- Removes 'win' from list.
- */
- {
- if (win == NULL) return; /* Error */
- if (win_GetAbove(win) == NULL) return; /* Error - can't remove list head */
-
- win_GetBelow(win_GetAbove(win)) = win_GetBelow(win);
- if (win_GetBelow(win) != NULL) {
- win_GetAbove(win_GetBelow(win)) = win_GetAbove(win);
- }
- win_GetAbove(win) = NULL;
- win_GetBelow(win) = NULL;
- }
- /* -------------------------------------------------------------------------- */
-
- static void OWLPRIV linkin(listtop, topwin, botwin)
- win_type listtop, topwin, botwin;
- /*
- Link windows between and including topwin and botwin into list below listtop.
- No error checking provided - for local use only.
- */
- {
- win_GetAbove(topwin) = listtop;
- win_GetBelow(botwin) = win_GetBelow(listtop);
-
- win_GetBelow(win_GetAbove(topwin)) = topwin;
- if (win_GetBelow(botwin) != NULL) {
- win_GetAbove(win_GetBelow(botwin)) = botwin;
- }
- }
- /* -------------------------------------------------------------------------- */
-
-