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

  1. /*
  2.     winmev.c  1/04/90
  3.  
  4.     % winmev_grantrequest
  5.  
  6.     Extracted by Joe from the file that    Ted extracted 
  7.     from the sed mouse handlers that Joe wrote.
  8.  
  9.     Standard function for handling the tricky business of accepting 
  10.     mouse request messages.
  11.  
  12.     OWL 1.2
  13.     Copyright (c) 1990 by Oakland Group, Inc.
  14.     ALL RIGHTS RESERVED.
  15.  
  16.     Revision History:
  17.     -----------------
  18.      1/04/90 jmd    re-vised, removed jump window
  19.      3/28/90 jmd    ansi-fied
  20.      8/27/90 ted    Added code to set next child for mev win instead of letting
  21.                      the accept_offer code do it.
  22. */
  23.  
  24. #include "oakhead.h"
  25. #include "disppriv.h"
  26. /* -------------------------------------------------------------------------- */
  27.  
  28. void winmev_grantrequest(win_type win, mev_struct *mev)
  29. /*
  30.     Grants a mouse request message, giving up control and setting up for the
  31.     mouse event window which issued the request to become the new current
  32.     window.
  33.  
  34.     'win' is the current window
  35.     'mev' is the mouse event
  36. */
  37. {
  38.     win_type newwin, tmp, ancestor;
  39.     int    childno;
  40.  
  41.     /*     Set up the new window so that when we pass control
  42.            to its ancestor window, control is passed on down to it.
  43.     
  44.         Check if we are in an embedded window, if so
  45.         get our owner, then check if our owner is an embedded
  46.         window, etc.  As we move up the chain of ownership,
  47.         we call SETCURRCHILD (GotoField) so that when our owner is activated
  48.         control will fall right into our lap.
  49.         We must set the current window's ancestor's nextwin to point to 
  50.         our owner so that the current can jump to our owner
  51.         instead of directly jumping to us.
  52.     */
  53.  
  54.     newwin = mev_GetWin(mev);
  55.  
  56.     childno = win_nextchild(newwin);
  57.     if (childno != -1) {
  58.         win_Do(newwin, WINM_SETCURRCHILD, &childno, NULL);
  59.     }
  60.     while ((tmp = bob_GetOwner(newwin, &childno)) != NULL) {
  61.         newwin = tmp;
  62.         win_Do(newwin, WINM_SETCURRCHILD, &childno, NULL);
  63.     }
  64.  
  65.     /* Now, find our ancestor window (we may be embedded)
  66.        and set its nextwin to jump to newwin.
  67.     */
  68.     ancestor = bob_GetAncestor(win);
  69.  
  70.     win_SetNextWin(ancestor, newwin);
  71. }
  72. /* -------------------------------------------------------------------------- */
  73.  
  74.