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.2
- 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
-
- 11/29/89 jmd added local variables to simplify macro expansion
- 3/28/90 jmd ansi-fied
- 6/22/90 ted added "void" to no-parameter function per ansii.
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
-
- OSTATIC void OWLPRIV linkin(win_type listtop, win_type topwin, win_type botwin);
-
- /* -------------------------------------------------------------------------- */
-
- win_type OWLPRIV wmgr_ListOpen(void)
- /*
- 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(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(win_type listtop, win_type 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_type win)
- /*
- Removes 'win' from list.
- */
- {
- win_type above, below;
-
- if (win == NULL) return; /* Error */
- if (win_GetAbove(win) == NULL) return; /* Error - can't remove list head */
-
- above = win_GetAbove(win);
- below = win_GetBelow(win);
- win_GetBelow(above) = below;
-
- if (below != NULL) {
- win_GetAbove(below) = above;
- }
-
- win_GetAbove(win) = NULL;
- win_GetBelow(win) = NULL;
- }
- /* -------------------------------------------------------------------------- */
-
- static void OWLPRIV linkin(win_type listtop, win_type topwin, win_type botwin)
- /*
- Link windows between and including topwin and botwin into list below listtop.
- No error checking provided - for local use only.
- */
- {
- win_type above, below;
-
- win_GetAbove(topwin) = listtop;
- win_GetBelow(botwin) = win_GetBelow(listtop);
-
- above = win_GetAbove(topwin);
- win_GetBelow(above) = topwin;
-
- if (win_GetBelow(botwin) != NULL) {
- below = win_GetBelow(botwin);
- win_GetAbove(below) = botwin;
- }
- }
- /* -------------------------------------------------------------------------- */
-
-