home *** CD-ROM | disk | FTP | other *** search
- /*
- grwin.c 9/11/88
-
- % Graphics window object.
- Implements a display/draw graphics window on the display.
- By Ted.
-
- OWL 1.1
- Copyright (c) 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- 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
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
- #include "pmwinobj.h"
- #include "pmwinod.h"
-
- #include "bordobj.h" /* for pmwin_SetPmap */
-
- /* -------------------------------------------------------------------------- */
-
- int grwin_Class(objdata, msg, indata, outdata)
- VOID *objdata; /* object instance data pointer */
- int msg; /* message */
- VOID *indata; /* message input data */
- VOID *outdata; /* message output data */
- /*
- 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;
- opbox relbox;
- ptd_struct *ptd;
- ptd_struct inptd; /* for use in inner-coordinate computations */
- opbox inbox; /* ditto; gets hooked in by ptd_SetInner */
- pmap_type pmap;
- winopendata_struct *wod;
-
- 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);
- }
- /* Note: pmwin open function initializes with NULL pmap pointer, */
- /* so we have to send a SETPMAP message after the OPEN message. */
- pmwin_getxd(grwinod_GetSelf(grwd))->pmap = pmap;
-
- return(pmwin_DoRaw(&(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_DoRaw(&(grwd->pmwd), msg, indata, outdata));
-
- case OBJM_WHO:
- /* Identify ourselves */
- if (*((int *) indata) == ID_GRWIN) {
- return(TRUE);
- }
- return(pmwin_DoRaw(&(grwd->pmwd), msg, indata, outdata));
-
- case WINM_ISAVE:
- case WINM_SAVE:
- ptd = (ptd_struct *)indata;
- if (ptd_SetInner(ptd, &inptd, &inbox)) {
- opbox_copy(&relbox, inptd.relboxp);
- opbox_trans(&relbox, grwd->pmwd.xoffs, grwd->pmwd.yoffs);
-
- pmap = grwin_GetPmap(grwinod_GetSelf(grwd));
- ptd_ReadPixmap(&inptd, pmap, &relbox);
- }
- pmwin_DoRaw(&(grwd->pmwd), msg, indata, outdata);
- break;
-
- case WINM_STARTCUR: /* no text cursor in this window class */
- case WINM_STOPCUR:
- break;
- }
- return(TRUE);
- }
- /* -------------------------------------------------------------------------- */
-
-