home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / BDBAR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-11  |  2.6 KB  |  110 lines

  1. /*
  2.     bdbar.c        8/02/88
  3.  
  4.     % border with scroll bar.
  5.  
  6.     OWL 1.1
  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.  
  21. #include "oakhead.h"
  22. #include "disppriv.h"
  23. #include "bordobj.h"
  24. #include "bordod.h"
  25.  
  26. #define    OUTER_BOX    "\332\304\277\263\331\304\300\263"
  27.  
  28. #ifdef BORDER_CHARS
  29. #define    SCROLL_BAR    "\261\261\261"
  30. #else
  31. #define    SCROLL_BAR    "XXX"
  32. #endif
  33.  
  34. /* border object data */
  35.  
  36. typedef struct {
  37.     border_od    bdd;                          /* border object super class */
  38. } bdbar_od;
  39.  
  40. int bd_bar(objdata, msg, indata, outdata)
  41.     VOID *objdata;
  42.     int msg;
  43.     VOID *indata;                /* message input data */
  44.     VOID *outdata;                /* message output data */
  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_DoRaw(&bdbd->bdd, msg, indata, outdata)) {
  65.             return(FALSE);
  66.         }
  67.         bord_SetSides(bdbd->bdd.win, -1, -1, 1, 1);
  68.         break;
  69.  
  70.     case BDM_SCROLL:
  71.         /* repaint the scroll bar */
  72.         cbox.toprow   = 0;
  73.         cbox.leftcol  = win_GetWidth(bdbd->bdd.win);
  74.         cbox.botrow   = win_GetHeight(bdbd->bdd.win) - 1;
  75.         cbox.rightcol = cbox.leftcol;
  76.         win_PaintBox(bdbd->bdd.win, &cbox);
  77.         break;
  78.  
  79.     case BDM_SHADOW:
  80.     case BDM_DRAW:
  81.         /* draw the border */
  82.         ptd = (ptd_struct *)indata;
  83.  
  84.         attr = (msg == BDM_DRAW) ? 
  85.             bord_GetAttr(bdbd->bdd.win) : win_GetShadowAttr(bdbd->bdd.win);
  86.  
  87.         /* draw the box */
  88.         bord_GetBox(bdbd->bdd.win, &cbox);
  89.         ptd_DrawCharBox(ptd, OUTER_BOX, &cbox, attr);
  90.  
  91.         /* draw the scroll bar */
  92.         cbox.toprow   = 0;
  93.         cbox.leftcol  = win_GetWidth(bdbd->bdd.win);
  94.         cbox.botrow   = win_GetHeight(bdbd->bdd.win) - 1;
  95.         cbox.rightcol = cbox.leftcol;
  96.  
  97.         bord_GetVtBar(bdbd->bdd.win, &cbox.toprow, &cbox.botrow, &top, &bottom);
  98.         ptd_DrawCharLine(ptd, SCROLL_BAR, &cbox, attr);
  99.  
  100.         /* else no break; pass message up to superclass */
  101.  
  102.     default:
  103.         /* pass messages up to border super class */
  104.         return(border_DoRaw(&bdbd->bdd, msg, indata, outdata));
  105.     }
  106.     return(1);
  107. }
  108. /* -------------------------------------------------------------------------- */
  109.  
  110.