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

  1. /*
  2.     bdbar.c        8/02/88
  3.  
  4.     % border with scroll bar.
  5.  
  6.     OWL 1.2
  7.     Copyright (c) 1988, by Oakland Group, Inc.
  8.     ALL RIGHTS RESERVED.
  9.  
  10.     Revision History:
  11.     -----------------
  12.      9/12/88 jmd    Added in and out data
  13.     11/13/88 jmd    Upgraded to new border stuff
  14.     11/20/88 jmd    Added ID to obj struct
  15.     12/20/88 jmd    removed SETSIZE msg
  16.  
  17.      5/28/89 jmd    added Shadow support
  18.      8/24/89 jmd    chnaged some ints to booleans
  19.  
  20.     11/06/89 jmd    removed DoRaw macros
  21.      2/21/90 ted    Added SetCharSize(TRUE) because border won't work otherwise.
  22.      3/28/90 jmd    ansi-fied
  23. */
  24.  
  25. #include "oakhead.h"
  26. #include "disppriv.h"
  27. #include "bordobj.h"
  28. #include "bordod.h"
  29.  
  30. #define    OUTER_BOX    "\332\304\277\263\331\304\300\263"
  31.  
  32. #ifdef BORDER_CHARS
  33. #define    SCROLL_BAR    "\261\261\261"
  34. #else
  35. #define    SCROLL_BAR    "XXX"
  36. #endif
  37.  
  38. /* border object data */
  39.  
  40. typedef struct _bdbarod {
  41.     border_od    bdd;                          /* border object super class */
  42. } bdbar_od;
  43.  
  44. int bd_bar(VOID *objdata, int msg, VOID *indata, VOID *outdata)
  45. /*
  46. */
  47. {
  48.     bdbar_od     *bdbd;
  49.     ocbox         cbox;
  50.     ptd_struct     *ptd;
  51.     boolean         top, bottom;        /* dummy values */
  52.     byte         attr;
  53.  
  54.     bdbd = (bdbar_od *)objdata;
  55.  
  56.     switch(msg) {
  57.     case OBJM_GETDATASIZE:
  58.         ((ogds_struct *) outdata)->odsize = sizeof(bdbar_od);
  59.         ((ogds_struct *) outdata)->xdsize = sizeof(border_xd);
  60.         ((ogds_struct *) outdata)->id = ID_BDBAR;
  61.         break;
  62.  
  63.     case OBJM_OPEN:
  64.         if (!border_Class(&bdbd->bdd, msg, indata, outdata)) {
  65.             return(FALSE);
  66.         }
  67.         win_SetCharSize(bdbd->bdd.win, TRUE);    /* This bord must be charsize */
  68.         bord_SetSides(bdbd->bdd.win, -1, -1, 1, 1);
  69.         break;
  70.  
  71.     case BDM_SCROLL:
  72.         /* repaint the scroll bar */
  73.         cbox.toprow   = 0;
  74.         cbox.leftcol  = win_GetWidth(bdbd->bdd.win);
  75.         cbox.botrow   = win_GetHeight(bdbd->bdd.win) - 1;
  76.         cbox.rightcol = cbox.leftcol;
  77.         win_PaintBox(bdbd->bdd.win, &cbox);
  78.         break;
  79.  
  80.     case BDM_SHADOW:
  81.     case BDM_DRAW:
  82.         /* draw the border */
  83.         ptd = (ptd_struct *)indata;
  84.  
  85.         attr = (msg == BDM_DRAW) ? 
  86.             bord_GetAttr(bdbd->bdd.win) : win_GetShadowAttr(bdbd->bdd.win);
  87.  
  88.         /* draw the box */
  89.         bord_GetBox(bdbd->bdd.win, &cbox);
  90.         ptd_DrawCharBox(ptd, OUTER_BOX, &cbox, attr);
  91.  
  92.         /* draw the scroll bar */
  93.         cbox.toprow   = 0;
  94.         cbox.leftcol  = win_GetWidth(bdbd->bdd.win);
  95.         cbox.botrow   = win_GetHeight(bdbd->bdd.win) - 1;
  96.         cbox.rightcol = cbox.leftcol;
  97.  
  98.         bord_GetVtBar(bdbd->bdd.win, &cbox.toprow, &cbox.botrow, &top, &bottom);
  99.         ptd_DrawCharLine(ptd, SCROLL_BAR, &cbox, attr);
  100.  
  101.         /* else no break; pass message up to superclass */
  102.  
  103.     default:
  104.         /* pass messages up to border super class */
  105.         return(border_Class(&bdbd->bdd, msg, indata, outdata));
  106.     }
  107.     return(1);
  108. }
  109. /* -------------------------------------------------------------------------- */
  110.  
  111.