home *** CD-ROM | disk | FTP | other *** search
- /*
- grwin.c
-
- % Graphics window object.
- Implements a display/draw graphics window on the display.
-
- OWL 1.2
- Copyright (c) 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- 9/11/88 By Ted.
-
- Revision History:
- -----------------
- 9/12/88 jmd Added in and out data to objects
- 11/20/88 jmd Added ID to obj struct
- 8/12/89 jdc Added INIT and WHO message
-
- 11/06/89 jmd removed DoRaw macros
- 11/10/89 jmd SAVE handling now uses inheritance
- 3/28/90 jmd ansi-fied
- 12/05/90 ted added EXPLODE ISAVE handling.
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
- #include "pmwinobj.h"
- #include "pmwinod.h"
-
- #include "bordobj.h" /* for pmwin_SetPmap */
-
- /* -------------------------------------------------------------------------- */
-
- int grwin_Class(VOID *objdata, int msg, VOID *indata, VOID *outdata)
- /*
- graphics window object dispatch function.
- A grmap displays a pixel map and causes the pixel map to absorb from the
- screen any graphics that are written into the window.
- */
- {
- grwin_od *grwd;
- pmap_type pmap;
- winopendata_struct *wod;
- win_type win;
-
- grwd = (grwin_od *) objdata;
-
- switch(msg) {
- case OBJM_GETDATASIZE:
- ((ogds_struct *) outdata)->odsize = sizeof(grwin_od);
- ((ogds_struct *) outdata)->xdsize = sizeof(grwin_xd);
- ((ogds_struct *) outdata)->id = ID_GRWIN;
- break;
-
- case OBJM_INIT:
-
- /* initialize pmap data */
- wod = (winopendata_struct *) indata;
-
- /* Allocate pixel map */
- if ((pmap = pmap_Open(opbox_GetWidth(wod->boxp), opbox_GetHeight(wod->boxp))) == NULL) {
- return(FALSE);
- }
- win = grwinod_GetSelf(grwd);
-
- /* Note: pmwin open function initializes with NULL pmap pointer, */
- /* so we have to set the pmap after the OPEN message. */
- grwin_SetPmap(win, pmap);
-
- /* Make this function its own object's Explode function */
- win_SetExplode(win, grwin_Class);
-
- return(pmwin_Class(&(grwd->pmwd), msg, indata, outdata));
-
- case OBJM_CLOSE:
- /* close pmap */
- pmap = grwin_GetPmap(grwinod_GetSelf(grwd));
- if (pmap != NULL) {
- pmap_Close(pmap);
- }
- /* No break: send CLOSE to win superclass */
- default:
- case OBJM_OPEN:
- case WINM_PAINT:
- case WINM_GETINPOS:
- /* pass other messages to win superclass */
- return(pmwin_Class(&(grwd->pmwd), msg, indata, outdata));
-
- case OBJM_WHO:
- /* Identify ourselves */
- if (*((int *) indata) == ID_GRWIN) {
- return(TRUE);
- }
- return(pmwin_Class(&(grwd->pmwd), msg, indata, outdata));
-
- case WINM_ISAVE: /* This is called during wmgr_Init if we're bgwin */
- case WINM_SAVE:
- case WINM_GRAB:
- case WINM_EXPLODE: /* A tricky trick to do ISAVE at employment time */
- /* pass GRAB message up to pmwin to grab from the display */
- pmwin_Class(&(grwd->pmwd), WINM_GRAB, indata, outdata);
-
- /* pass SAVE and ISAVE messages up for processing by win class */
- if (msg == WINM_SAVE || msg == WINM_ISAVE) {
- pmwin_Class(&(grwd->pmwd), msg, indata, outdata);
- }
- break;
-
- case WINM_STARTCUR: /* no text cursor in this window class */
- case WINM_STOPCUR:
- break;
- }
- return(TRUE);
- }
- /* -------------------------------------------------------------------------- */
-
-