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

  1. /*
  2.     mevdecl.h
  3.  
  4.     % Mouse event declarations
  5.  
  6.     11/18/88  by Ted.
  7.  
  8.     OWL 1.1
  9.     Copyright (c) 1988, by Oakland Group, Inc.
  10.     ALL RIGHTS RESERVED.
  11.  
  12.     Revision History:
  13.     -----------------
  14.     12/20/88 jmd    Changed values of MOU codes
  15.      1/10/89 jdc    Fixed mev_IsButton macros
  16.      3/10/89 ted    Moved MOU codes into scancode.h for portability
  17.      3/30/89 ted    Renamed mouevent_struct to mev_struct
  18.      5/11/89 ted    Added MEV_STARTCUR and MEV_STOPCUR messages.
  19. */
  20. /* -------------------------------------------------------------------------- */
  21.  
  22. typedef struct {
  23.     opcoord  x;            /* Absolute screen coordinates of mouse */
  24.     opcoord  y;
  25.     unsigned event;        /* Mouse event as defined below */
  26. } moupos_struct;
  27. /* -------------------------------------------------------------------------- */
  28. /* Mouse event structure - it is (and should stay) like a moupos_struct with */
  29. /* a window tacked on. Most of the mev_ macros will therefore work on both */
  30. /* structures. */
  31.  
  32. typedef struct {
  33.     opcoord     x;            /* Window coordinates of mouse */
  34.     opcoord     y;
  35.     unsigned     event;        /* Mouse event as defined below */
  36.  
  37.     obj_type     win;        /* Window mouse is in */
  38.     unsigned    inborder:1;
  39.     unsigned    incurrent:1;
  40. } mev_struct;
  41. /* -------------------------------------------------------------------------- */
  42.  
  43. #define MEV_MOVE            0x0001
  44. #define MEV_BUT1MOVE        0x0002
  45. #define MEV_BUT1            0x0004
  46. #define MEV_BUT2MOVE        0x0008
  47. #define MEV_BUT2            0x0010
  48. #define MEV_BUT3MOVE        0x0020
  49. #define MEV_BUT3            0x0040
  50.  
  51. /* -------------------------------------------------------------------------- */
  52. #define mev_GetWin(mev)                ((mev)->win)
  53. #define mev_GetRow(mev)                                \
  54.     opcoord_GetYRow(mev_GetY(mev),win_GetFont(mev_GetWin(mev)))
  55.  
  56. #define mev_GetCol(mev)                                \
  57.     opcoord_GetXCol(mev_GetX(mev),win_GetFont(mev_GetWin(mev)))
  58.  
  59. /* The following macros will work on mouevent_struc's or moupos_struc's */
  60. #define mev_GetX(mev)                ((mev)->x)
  61. #define mev_GetY(mev)                ((mev)->y)
  62. #define mev_GetEvent(mev)            ((mev)->event)
  63.  
  64. #define mevbmask(ev)                                \
  65.     (((ev) | ((ev) << 1)) & (MEV_BUT1 | MEV_BUT2 | MEV_BUT3))
  66.  
  67. #define mev_IsButtonDown(mev)        (mevbmask(mev_GetEvent(mev)) != 0)
  68. #define mev_IsButton1Down(mev)        ((mev_GetEvent(mev) & (MEV_BUT1 | MEV_BUT1MOVE)) != 0)
  69. #define mev_IsButton2Down(mev)        ((mev_GetEvent(mev) & (MEV_BUT2 | MEV_BUT2MOVE)) != 0)
  70. #define mev_IsButton3Down(mev)        ((mev_GetEvent(mev) & (MEV_BUT3 | MEV_BUT3MOVE)) != 0)
  71. #define mev_ClearEvent(mev)            ((mev)->event = 0xF000)
  72. #define mev_IsEventClear(mev)        ((mev)->event == 0xF000)
  73.  
  74. #define mev_ButtonGoneUp(oev, nev)                    \
  75.     (mevbmask((nev)|(oev)) > mevbmask(nev))
  76.  
  77. #define mev_ButtonGoneDown(oev, nev)                \
  78.     (mevbmask((nev)|(oev)) > mevbmask(oev))
  79.  
  80. #define mev_MovedOut(fmev, cmev, dist)        \
  81.     (oabs((cmev)->x - (fmev)->x) > (dist) || oabs((cmev)->y - (fmev)->y) > (dist))
  82.  
  83. /* -------------------------------------------------------------------------- */
  84. /* Messages a mouse handler receives when its window is not current */
  85. #define MEV_STARTOFFER        1
  86. #define MEV_OFFER            2
  87. #define MEV_ENDOFFER        3
  88.  
  89. /* Messages a mouse handler receives when its window is current */
  90. #define MEV_REQUEST            4
  91. #define MEV_STARTEVENT        5
  92. #define MEV_EVENT            6
  93. #define MEV_ENDEVENT        7
  94.  
  95. /* Messages a mouse handler receives when its window becomes current */
  96. #define MEV_STARTCUR        8
  97. #define MEV_STOPCUR            9
  98. /* -------------------------------------------------------------------------- */
  99.  
  100.