home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / CSAPE32.ARJ / SOURCE / OWLSCR / CMWINIMO.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-22  |  1.6 KB  |  69 lines

  1. /*
  2.     cmwinimo.c    12/12/88
  3.  
  4.     % Window Request handler function for use by mouse borders & maybe others.
  5.     By Ted.
  6.  
  7.     OWL 1.2
  8.     Copyright (c) 1988, by Oakland Group, Inc.
  9.     ALL RIGHTS RESERVED.
  10.  
  11.     Revision History:
  12.     -----------------
  13.      5/19/89 jmd    removed static for silly UNIX compiler
  14.      8/11/89 jmd    reconstructed init function
  15.  
  16.      3/28/90 jmd    ansi-fied
  17.      6/22/90 ted    added "void" to no-parameter function per ansii.
  18. */
  19.  
  20. #include "oakhead.h"
  21. #include "disppriv.h"
  22. #include "cmwinod.h"
  23. #include "cmwinobj.h"
  24. #include "bordobj.h"
  25.  
  26. OSTATIC objreq_func (cmwinreq_mouse);
  27.  
  28. /* -------------------------------------------------------------------------- */
  29.  
  30. void cmwin_MouseInit(void)
  31. /*
  32.     Attach mouse handling function to cmwin_Class
  33. */
  34. {
  35.     cmwinreq_mousefptr = cmwinreq_mouse;
  36.  
  37.     win_MouseInit();
  38. }
  39.  
  40. /* -------------------------------------------------------------------------- */
  41.  
  42. static int cmwinreq_mouse(VOID *objdata, int msg, VOID *indata, VOID *outdata)
  43. {
  44.     cmwin_od *cmwd;
  45.     win_type win;
  46.     int nr, nc;
  47.  
  48.     /* outdata not used in this function */ oak_notused(outdata);
  49.  
  50.     cmwd = (cmwin_od *) objdata;
  51.  
  52.     switch(msg) {
  53.     case WINM_SCROLLREQ:
  54.         win = cmwinod_GetSelf(cmwd);
  55.         nr = ((opoint *)indata)->y / win_GetFontHeight(win);
  56.         nc = ((opoint *)indata)->x / win_GetFontWidth(win);
  57.         cmwin_SetRowoffs(win, cmwin_GetRowoffs(win) + nr);
  58.         cmwin_SetColoffs(win, cmwin_GetColoffs(win) + nc);
  59.         
  60.         win_Scroll(win, nr, nc);
  61.  
  62.         bord_SendMsg(win, BDM_SCROLL, NULL, NULL);
  63.         break;
  64.     }
  65.     return(TRUE);
  66. }
  67. /* -------------------------------------------------------------------------- */
  68.  
  69.