home *** CD-ROM | disk | FTP | other *** search
- /*
- msgwin.c 8/07/89
-
- % msg window object.
- By jmd.
-
- This is a window that display a one line message.
- It is used by bd_null.
-
- OWL 1.1
- Copyright (c) 1989, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
- #include "msgwin.h"
-
- /*** msgwinod ***/
-
- #include "winod.h"
-
- /* The message window class */
-
- typedef struct {
- win_od wd; /* window super class */
- } msgwin_od;
-
- #define msgwinod_GetSelf(msgwdd) (winod_GetSelf(&(msgwdd)->wd))
-
- /* -------------------------------------------------------------------------- */
-
- int msgwin_Class(objdata, msg, indata, outdata)
- VOID *objdata; /* object instance data pointer */
- int msg; /* message */
- VOID *indata; /* message input data */
- VOID *outdata; /* message output data */
- /*
- message window object dispatch function
- */
- {
- msgwin_od *mwd;
- opbox relbox;
- ptd_struct *ptd;
- ptd_struct inptd; /* for use in inner-coordinate computations */
- opbox inbox; /* ditto; gets hooked in by ptd_SetInner */
- win_type win;
- char *string;
- int len;
-
- mwd = (msgwin_od *) objdata;
-
- switch(msg) {
- case OBJM_GETDATASIZE:
- ((ogds_struct *) outdata)->odsize = sizeof(msgwin_od);
- ((ogds_struct *) outdata)->xdsize = sizeof(msgwin_xd);
- ((ogds_struct *) outdata)->id = ID_MSGWIN;
- break;
-
- case OBJM_OPEN:
- /* initialize xd */
- msgwin_SetMsg(msgwinod_GetSelf(mwd), NULL);
- /* no break, fall through to default */
-
- default:
- /* pass other messages to win superclass */
- return(win_DoRaw(&(mwd->wd), msg, indata, outdata));
-
- case OBJM_WHO:
- /* Identify ourselves */
- if (*((int *) indata) == ID_MSGWIN) {
- return(TRUE);
- }
- return(win_DoRaw(&(mwd->wd), msg, indata, outdata));
-
- case WINM_PAINT:
- /* paint the msg */
- ptd = (ptd_struct *)indata;
- win = ptd->win;
-
- if (ptd_SetInner(ptd, &inptd, &inbox)) {
- /* The inner ptd does not include the window border */
- opbox_copy(&relbox, inptd.relboxp);
-
- if ((string = msgwin_GetMsg(win)) == NULL) {
- len = 0;
- }
- else {
- ptd_DrawString(&inptd, 0, 0, string, win_GetAttr(win), (len = strlen(string)));
- }
-
- ptd_ClearFrame(&inptd, 0, 0,
- len * win_GetFontWidth(win), win_GetFontHeight(win),
- win_GetBgColor(ptd->win));
- }
-
- win_DoRaw(&(mwd->wd), msg, indata, outdata);
- break;
- }
-
- return(TRUE);
- }
-