home *** CD-ROM | disk | FTP | other *** search
- /*
- bdnull.c 5/07/87
-
- % The null border.
-
- OWL 1.1
- Copyright (c) 1986, 1987, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 8/08/88 jmd Upgraded to new border stuff
- 9/12/88 jmd Added in and out data
- 10/05/88 jmd Prompts now use a fixed (allocated) data buffer
- 11/15/88 jmd Prompts now use a cmap window
- 11/20/88 jmd Added ID to obj struct
- 8/08/89 jmd Prompts now the new msg window
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
- #include "msgwin.h"
- #include "bordobj.h"
- #include "bordod.h"
-
- /* border object data */
-
- typedef struct {
- border_od bdd; /* common object super class */
- win_type msgwin; /* prompt window */
- char prompt[BD_PROMPTLEN + 1]; /* space for border prompt */
- } bdnull_od;
-
- /* -------------------------------------------------------------------------- */
-
- int bd_null(objdata, msg, indata, outdata)
- VOID *objdata;
- int msg;
- VOID *indata; /* message input data */
- VOID *outdata; /* message output data */
- /*
- This is the "null" border used by some C-scape library
- routines.
- It is actully not a border but simply a function that
- will intercept requests to display prompt strings and place
- them in a window on the bottom line of the display.
-
- The prompt is limited to the width of the display.
- */
- {
- bdnull_od *bdnulld;
- char *p;
- ocbox cbox;
-
- bdnulld = (bdnull_od *)objdata;
-
- switch(msg) {
- case OBJM_GETDATASIZE:
- ((ogds_struct *) outdata)->odsize = sizeof(bdnull_od);
- ((ogds_struct *) outdata)->xdsize = sizeof(border_xd);
- ((ogds_struct *) outdata)->id = ID_BDNULL;
- break;
-
- case OBJM_OPEN:
- if (!border_DoRaw(&bdnulld->bdd, msg, indata, outdata)) {
- return(FALSE);
- }
-
- /* open a msgwin for the prompt */
- cbox.toprow = disp_GetHeight() - 1;
- cbox.leftcol = 0;
- cbox.botrow = cbox.toprow;
- cbox.rightcol = disp_GetWidth() - 1;
-
- if ((bdnulld->msgwin = win_Open(msgwin_Class, &cbox)) == NULL) {
- return(FALSE);
- }
-
- bdnulld->prompt[0] = '\0';
-
- win_SetAttr(bdnulld->msgwin, win_GetAttr(bdnulld->bdd.win));
-
- /* move the prompt window above the client window */
- win_PutUnder(bdnulld->msgwin, win_GetAbove(bdnulld->bdd.win));
- break;
-
- case BDM_PROMPT:
- /* write the border prompt string to the msgwin */
- /* set the border prompt string */
- p = (indata != NULL) ? ((char *) indata) : "";
-
- /* Test if prompt has changed */
- if (strcmp(p, bdnulld->prompt) != 0) {
- strncpy(bdnulld->prompt, p, BD_PROMPTLEN);
- bdnulld->prompt[BD_PROMPTLEN] = '\0';
-
- /* update the prompt */
- msgwin_SetMsg(bdnulld->msgwin, bdnulld->prompt);
- win_Paint(bdnulld->msgwin);
- }
-
- /* move the prompt window above the client window */
- win_PutUnder(bdnulld->msgwin, win_GetAbove(bdnulld->bdd.win));
- break;
-
- case OBJM_CLOSE:
- /* Close the msgwin */
- win_Close(bdnulld->msgwin);
-
- /* No break; fall through to default */
-
- default:
- return(border_DoRaw(&bdnulld->bdd, msg, indata, outdata));
- }
-
- return(1);
- }
- /* -------------------------------------------------------------------------- */
-
-