home *** CD-ROM | disk | FTP | other *** search
- /*
- winopen.c 1/20/88
-
- % Spiffy windowing routines.
- by John Cooke and Joe DeSantis.
- Hacked up royally by Ted.
-
- 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/18/88 Ted Added wmgr struct and disp_ calls
- 6/16/88 Ted revised to have inheritance and class factory functions.
- 8/10/88 jmd Added new object stuff
- 8/13/88 jmd Made win_GetAttr and win_SetAttr functions
- 8/15/88 jmd added winopen_struct, data arg to dwin_Open
- 8/17/88 jmd (undid above), removed eNOMEM
- 9/12/88 jmd Added in and out data to objects
- 10/30/88 Ted Removed employ/unemploy to their own file.
- 10/31/88 Ted Removed linking.
- 11/20/88 jmd changed win_Do(GET_ID) to obj_GetID()
- 11/29/88 Ted instituted dwmgr_ funtion names
- 12/09/88 ted Added ddisp_Cache/Flush calls for mouse.
- 12/11/88 ted Added dhard_Claim/Release calls for reentrancy.
- 3/24/89 ted Moved wmgr_Init/Wrapup from win.c to wmgrinit.c.
- 3/24/89 ted Made win's pure objects. Eliminated win_CreateWin,
- wmgr_Destroy win by folding them into win_Class.
- 3/24/89 ted Renamed from win.c.
- 3/24/89 ted Changed order of args to win_Open and win_PixOpen.
- 5/31/89 jmd Removed win_Paint from win_SetAttr
- 8/12/89 jdc Removed win_Close (now obj_Close)
- 8/12/89 ted Moved win_SetShadow in here.
- 8/18/89 ted Added win_OpenRaw.
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
-
- /* -------------------------------------------------------------------------- */
-
- win_type win_Open(winclass, cboxp)
- class_fptr winclass; /* pointer to window's dispatch function */
- ocbox *cboxp;
- {
- /*
- Open a window in character box coordinates.
- */
- opbox box;
- ofont_type font;
-
- font = disp_GetDefFont();
-
- ocbox_pixcoords(cboxp, font, &box);
- return (win_PixOpen(winclass, &box, font));
- }
- /* -------------------------------------------------------------------------- */
-
- win_type win_PixOpen(winclass, boxp, font)
- class_fptr winclass; /* pointer to window's dispatch function */
- opbox *boxp;
- ofont_type font;
- /*
- Open a new window in pixel coordinates, with a font spec,
- and add it to the unemployed window list.
- */
- {
- winopendata_struct wod;
-
- wod.boxp = boxp;
- wod.font = font;
- wod.list = curr_wmgr->unemployedhead;
-
- return(win_OpenRaw(winclass, &wod));
- }
- /* -------------------------------------------------------------------------- */
-
- win_type win_OpenRaw(winclass, wodp)
- class_fptr winclass; /* pointer to window's dispatch function */
- winopendata_struct *wodp;
- {
- win_type win;
-
- owl_Assert(disp_Ok(), OE_WO_DISP);
-
- hard_Claim(); /* Here for re-entrancy protection */
-
- /* Initialize the new window object */
- if ((win = obj_Open(winclass, NULL)) != NULL) {
- if (!win_Do(win, OBJM_INIT, wodp, NULL)) {
- obj_Close(win);
- win = NULL;
- }
- }
- hard_Release();
-
- return(win);
- }
- /* -------------------------------------------------------------------------- */
-
- void win_SetAttr(win, attr)
- win_type win;
- byte attr;
- /*
- Sets the background attribute of win to attr.
- */
- {
- win_setattribute(win, attr);
- }
- /* -------------------------------------------------------------------------- */
-
- void win_SetShadow(win, csize)
- win_type win;
- int csize;
- /*
- Set the csize of the window's shadow (in characters)
- */
- {
- win_SetPixShadow(win,
- csize * win_GetFontWidth(win),
- csize * win_GetFontHeight(win));
- }
- /* -------------------------------------------------------------------------- */
-
-