home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / CSAPE32.ARJ / SOURCE / OWLSCR / BD123.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-23  |  2.6 KB  |  97 lines

  1. /*
  2.     bd123.c        7/09/87
  3.  
  4.     % The 123 border.
  5.  
  6.     OWL 1.2
  7.     Copyright (c) 1986, 1987, by Oakland Group, Inc.
  8.     ALL RIGHTS RESERVED.
  9.  
  10.     Revision History:
  11.     -----------------
  12.      7/27/88 jmd     Upgraded to new border stuff
  13.      9/12/88 jmd    Added in and out data to objects
  14.     10/05/88 jmd    Prompts now use a fixed (allocated) data buffer
  15.     11/02/88 ted    Changed to new non-window border scheme
  16.     11/20/88 jmd    Added ID to obj struct
  17.     12/20/88 jmd    removed SETSIZE msg
  18.  
  19.      5/28/89 jmd    added Shadow support
  20.  
  21.     11/06/89 jmd    removed DoRaw macros
  22.      2/21/90 ted    Added SetCharSize(TRUE) because border won't work otherwise.
  23.      3/28/90 jmd    ansi-fied
  24. */
  25.  
  26. #include "oakhead.h"
  27. #include "disppriv.h"
  28. #include "bordobj.h"
  29. #include "bordod.h"
  30.  
  31. /* border object data */
  32.  
  33. typedef struct _bd123od {
  34.     border_od    bdd;                          /* common object super class */
  35.     char         prompt[BD_PROMPTLEN + 1];    /* space for prompt */
  36. } bd123_od;
  37.  
  38. int bd_123(VOID *objdata, int msg, VOID *indata, VOID *outdata)
  39. /*
  40.     This is the 123 border used by the slug menuing system.
  41.     It is a function that will intercept requests to display prompt strings
  42.     and place them below the sed.
  43.     The prompt is limited to BD_PROMPTLEN (80) characters in length.
  44. */
  45. {
  46.     bd123_od     *bd123d;
  47.     int             row, len;
  48.     char        *p;
  49.     byte         attr;
  50.  
  51.     bd123d = (bd123_od *)objdata;
  52.     
  53.     switch(msg) {
  54.     case OBJM_GETDATASIZE:
  55.         ((ogds_struct *) outdata)->odsize = sizeof(bd123_od);
  56.         ((ogds_struct *) outdata)->xdsize = sizeof(border_xd);
  57.         ((ogds_struct *) outdata)->id = ID_BD123;
  58.         break;
  59.  
  60.     case OBJM_OPEN:
  61.         if (!border_Class(&bd123d->bdd, msg, indata, outdata)) {
  62.             return(FALSE);
  63.         }
  64.         bd123d->prompt[0] = '\0';
  65.         win_SetCharSize(bd123d->bdd.win, TRUE);    /* This bord must be charsize */
  66.         bord_SetSides(bd123d->bdd.win, 0, 0, 1, 0);
  67.         break;
  68.  
  69.     case BDM_PROMPT:    /* set the border prompt string */
  70.         p = (indata != NULL) ? ((char *) indata) : "";
  71.         strncpy(bd123d->prompt, p, BD_PROMPTLEN);
  72.         bd123d->prompt[BD_PROMPTLEN] = '\0';
  73.  
  74.         /* update the prompt (paint bottom border row) */
  75.         row = bord_GetHeight(bd123d->bdd.win) - 1;
  76.         len = bord_GetWidth(bd123d->bdd.win);
  77.         win_PaintRow(bd123d->bdd.win, row, 0, len);
  78.         break;
  79.  
  80.     case BDM_SHADOW:
  81.     case BDM_DRAW:        /* draw the message */
  82.         row = bord_GetHeight(bd123d->bdd.win) - 1;
  83.         len = bord_GetWidth(bd123d->bdd.win);
  84.         attr = (msg == BDM_DRAW) ? 
  85.             bord_GetAttr(bd123d->bdd.win) : win_GetShadowAttr(bd123d->bdd.win);
  86.  
  87.         ptd_DrawString((ptd_struct *)indata, row, 0, bd123d->prompt, attr, len);
  88.  
  89.         /* else no break; pass message up to superclass */
  90.  
  91.     default:
  92.         return(border_Class(&bd123d->bdd, msg, indata, outdata));
  93.     }
  94.     return(TRUE);
  95. }
  96.  
  97.