home *** CD-ROM | disk | FTP | other *** search
- /*
- bd123.c 7/09/87
-
- % The 123 border.
-
- OWL 1.2
- Copyright (c) 1986, 1987, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 7/27/88 jmd Upgraded to new border stuff
- 9/12/88 jmd Added in and out data to objects
- 10/05/88 jmd Prompts now use a fixed (allocated) data buffer
- 11/02/88 ted Changed to new non-window border scheme
- 11/20/88 jmd Added ID to obj struct
- 12/20/88 jmd removed SETSIZE msg
-
- 5/28/89 jmd added Shadow support
-
- 11/06/89 jmd removed DoRaw macros
- 2/21/90 ted Added SetCharSize(TRUE) because border won't work otherwise.
- 3/28/90 jmd ansi-fied
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
- #include "bordobj.h"
- #include "bordod.h"
-
- /* border object data */
-
- typedef struct _bd123od {
- border_od bdd; /* common object super class */
- char prompt[BD_PROMPTLEN + 1]; /* space for prompt */
- } bd123_od;
-
- int bd_123(VOID *objdata, int msg, VOID *indata, VOID *outdata)
- /*
- This is the 123 border used by the slug menuing system.
- It is a function that will intercept requests to display prompt strings
- and place them below the sed.
- The prompt is limited to BD_PROMPTLEN (80) characters in length.
- */
- {
- bd123_od *bd123d;
- int row, len;
- char *p;
- byte attr;
-
- bd123d = (bd123_od *)objdata;
-
- switch(msg) {
- case OBJM_GETDATASIZE:
- ((ogds_struct *) outdata)->odsize = sizeof(bd123_od);
- ((ogds_struct *) outdata)->xdsize = sizeof(border_xd);
- ((ogds_struct *) outdata)->id = ID_BD123;
- break;
-
- case OBJM_OPEN:
- if (!border_Class(&bd123d->bdd, msg, indata, outdata)) {
- return(FALSE);
- }
- bd123d->prompt[0] = '\0';
- win_SetCharSize(bd123d->bdd.win, TRUE); /* This bord must be charsize */
- bord_SetSides(bd123d->bdd.win, 0, 0, 1, 0);
- break;
-
- case BDM_PROMPT: /* set the border prompt string */
- p = (indata != NULL) ? ((char *) indata) : "";
- strncpy(bd123d->prompt, p, BD_PROMPTLEN);
- bd123d->prompt[BD_PROMPTLEN] = '\0';
-
- /* update the prompt (paint bottom border row) */
- row = bord_GetHeight(bd123d->bdd.win) - 1;
- len = bord_GetWidth(bd123d->bdd.win);
- win_PaintRow(bd123d->bdd.win, row, 0, len);
- break;
-
- case BDM_SHADOW:
- case BDM_DRAW: /* draw the message */
- row = bord_GetHeight(bd123d->bdd.win) - 1;
- len = bord_GetWidth(bd123d->bdd.win);
- attr = (msg == BDM_DRAW) ?
- bord_GetAttr(bd123d->bdd.win) : win_GetShadowAttr(bd123d->bdd.win);
-
- ptd_DrawString((ptd_struct *)indata, row, 0, bd123d->prompt, attr, len);
-
- /* else no break; pass message up to superclass */
-
- default:
- return(border_Class(&bd123d->bdd, msg, indata, outdata));
- }
- return(TRUE);
- }
-
-