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

  1. /*
  2.     bdmouse.c    11/21/88
  3.  
  4.     % box border with scroll lights and mouse support.
  5.  
  6.     OWL 1.1
  7.     Copyright (c) 1988, 1989 by Oakland Group, Inc.
  8.     ALL RIGHTS RESERVED.
  9.  
  10.     Revision History:
  11.     -----------------
  12.     12/09/88 ted    Fixed pixel coordinate bugs in sizing functions.
  13.     12/18/88 jdc    made it a subclass of bdsidebar
  14.  
  15.      5/23/89 jmd    added "border features"
  16.     06/03/89 jdc    fixed TITLE and PROMPT messages
  17.      7/06/89 ted    Made RESIZE message go through to both parents
  18. */
  19.  
  20. #include "oakhead.h"
  21. #include "disppriv.h"
  22. #include "strdecl.h"
  23.  
  24. #include "bordobj.h"
  25. #include "bordod.h"
  26. #include "bdmousod.h"
  27.  
  28. /* -------------------------------------------------------------------------- */
  29.  
  30. int bd_mouse(objdata, msg, indata, outdata)
  31.     VOID *objdata;
  32.     int msg;
  33.     VOID *indata;                /* message input data */
  34.     VOID *outdata;                /* message output data */
  35. /*
  36.     This is a simple single lined border.
  37.     With an overwritten title and scroll lights on the bottom.
  38.     The title is pointed to by the border data pointer.
  39.     Example:
  40.                      +-----Title-----+
  41.                      |                 <--- Scroll Lights
  42.                      |               I
  43.                      |               X    <--- Elevator
  44.                      |               I
  45.                      |                 <--- Scroll Lights
  46.                      +Prompt---------+
  47.  
  48.     Clicking the mouse on the scroll lights scrolls the border's contents.
  49.     Dragging the mouse on an edge moves the window.
  50.     Dragging the mouse on a corner resizes the window.
  51.  
  52. */
  53. {
  54.     bdmouse_od *bdmousod;
  55.  
  56.     bdmousod = (bdmouse_od *)objdata;
  57.  
  58.     switch(msg) {
  59.     case OBJM_GETDATASIZE:
  60.         ((ogds_struct *) outdata)->odsize = sizeof(bdmouse_od);
  61.         ((ogds_struct *) outdata)->xdsize = sizeof(border_xd);
  62.         ((ogds_struct *) outdata)->id = ID_BDMOUSE;
  63.         break;
  64.  
  65.     case OBJM_OPEN:
  66.         /* because this class inherits two od's and obj_Open only inits the */
  67.         /* self ptr of one of them, init the other one here */
  68.         bdpromod_GetSelf(&bdmousod->prompt) = bdsideod_GetSelf(&bdmousod->sidebar);
  69.  
  70.         if (!bdsidebar_DoRaw(&bdmousod->sidebar, msg, indata, outdata)) {
  71.             return(FALSE);
  72.         }
  73.         if (!bdprompt_DoRaw(&bdmousod->prompt, msg, indata, outdata)) {
  74.             bdsidebar_DoRaw(&bdmousod->sidebar, OBJM_CLOSE, NULL, NULL);
  75.             return(FALSE);
  76.         }
  77.          bdmousod->sidebar.back = '\263';
  78.  
  79.         /* turn on mouse features */
  80.         bdmousod->sidebar.bdd.resize = 1;        /* mouse resize flag */
  81.         bdmousod->sidebar.bdd.move = 1;            /* mouse move flag */
  82.  
  83.         break;
  84.  
  85.     /* Messages that go to sidebar parent */
  86.     case BDM_STARTMOUSE:
  87.     case BDM_ENDMOUSE:        /* Mouse left the border. */
  88.     case BDM_MOUSE:
  89.         bdsidebar_DoRaw(&bdmousod->sidebar, msg, indata, outdata);
  90.         break;
  91.  
  92.     /* only bdprompt has a title and prompt */
  93.     case BDM_SETTITLE:
  94.     case BDM_GETTITLE:
  95.     case BDM_PROMPT:
  96.         bdprompt_DoRaw(&bdmousod->prompt, msg, indata, outdata);
  97.         break;
  98.  
  99.     /* Messages that go to both prompt and sidebar parents */
  100.     default:
  101.         /* Note that bd_prompt must paint first */
  102.         bdprompt_DoRaw(&bdmousod->prompt, msg, indata, outdata);
  103.         bdsidebar_DoRaw(&bdmousod->sidebar, msg, indata, outdata);
  104.         break;
  105.     }
  106.     return(1);
  107. }
  108. /* -------------------------------------------------------------------------- */
  109.  
  110.