home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / CSAPE32.ARJ / SOURCE / OWLSCR / BDMOUSE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-03-28  |  3.0 KB  |  105 lines

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