home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pmstabar.zip / ApiExPM.h next >
C/C++ Source or Header  |  2002-01-27  |  4KB  |  94 lines

  1. //===========================================================================\
  2. // ApiExPM.h: General purpose PM macros and definitions
  3. // 24-12-2001 * by Alessandro Cantatore * v...
  4. //===========================================================================/
  5.  
  6.  
  7.  
  8. #ifndef _APIEX_PM_H_
  9.    #define _APIEX_PM_H_
  10.  
  11. // new type definitions
  12. // image handle : this is used by the control which can display both icons
  13. // and bitmaps
  14. typedef LHANDLE HIMAGE;
  15. typedef HIMAGE * PHIMAGE;
  16.  
  17. // Message result definitions
  18. #define MRFALSE ((MRESULT)0)
  19. #define MRTRUE  ((MRESULT)1)
  20.  
  21. // Undocumented messages generated by Warp 4 and superior versions
  22. // These messages are posted to a window when the mouse pointer enters
  23. // or leaves the window rectangle.
  24. // The default window procedure returns FALSE in both cases
  25.  
  26. // mouse getting inside the window area
  27. // mp1 : handle of the window the mouse is moving to
  28. // mp2 : handle of the window previously under the mouse
  29. #define WM_MOUSEENTER      0x041e
  30.  
  31. // mouse getting outside the window area
  32. // mp1 : handle of the window the mouse is moving away from
  33. // mp2 : handle of the window the mouse is moving to
  34. #define WM_MOUSEEXIT       0x041f    // mouse leaving the window area
  35.  
  36.  
  37. // gets x, y coordinates from a mouse message parameter
  38. #define MOUSEX(mp)          ((SHORT)(ULONG)(mp))
  39. #define MOUSEY(mp)          ((SHORT)((ULONG)mp >> 16))
  40.  
  41. // New system pointer: display a hand with a finger
  42. #define SPTR_HANDCLICK   (SPTR_CPTR + 1)
  43. // Macro to set a system pointer (used in WM_MOUSEMOVE processing)
  44. #define WinSetSysPointer(iptr) \
  45.    (WinSetPointer(HWND_DESKTOP, WinQuerySysPointer(HWND_DESKTOP, (iptr), 0)))
  46.  
  47.  
  48. // general PM query window macros
  49. #define WinHAB(hwnd)         (WinQueryAnchorBlock(hwnd))
  50. #define WinID(hwnd)          (WinQueryWindowUShort((hwnd), QWS_ID))
  51. #define WinNext(hwnd)        (WinQueryWindow((hwnd), QW_NEXT))
  52. #define WinOwner(hwnd)       (WinQueryWindow((hwnd), QW_OWNER))
  53. #define WinParent(hwnd)      (WinQueryWindow((hwnd), QW_PARENT))
  54. #define WinStyle(hwnd)       (WinQueryWindowULong((hwnd), QWL_STYLE))
  55.  
  56. // general dialog macros
  57. #define DlgItemHwnd(hwnd, id)    (WinWindowFromID((hwnd), (id)))
  58. #define DlgItemEnable(hwnd, id, benable) \
  59.    (WinEnableWindow(DlgItemHwnd((hwnd), (id)), (benable)))
  60. #define DlgItemIsEnabled(hwnd, id) \
  61.    (WinIsWindowEnabled(DlgItemHwnd((hwnd), (id))))
  62. #define DlgItemShow(hwnd, id, bshow) \
  63.    (WinShowWindow(DlgItemHwnd((hwnd), (id)), (bshow)))
  64. #define DlgItemIsVisible(hwnd, id) \
  65.    (WinIsWindowVisible(DlgItemHwnd((hwnd), (id))))
  66.  
  67. // general purpose point and rectangle manipulation macros
  68. // the ppt and prect parameters must be pointer to POINT and RECTL
  69. // Initializes a point structure
  70. #define PointSet(ppt, _x, _y)   \
  71.   (((PPOINTL)(ppt))->x = (_x),  \
  72.    ((PPOINTL)(ppt))->y = (_y))
  73. // Simmetrically shifts the rectangle coordinates by dx,dy pixels
  74. #define RectInflate(prect, dx, dy)                                \
  75.                            (((PRECTL)(prect))->xLeft -= (dx),     \
  76.                             ((PRECTL)(prect))->yBottom -= (dy),   \
  77.                             ((PRECTL)(prect))->xRight += (dx),    \
  78.                             ((PRECTL)(prect))->yTop += (dy))
  79. // Initializes a rectangle with the coordinates (x0,y0) - (x1,y1)
  80. #define RectSet(prect, x0, y0, x1, y1)                            \
  81.                            (((PRECTL)(prect))->xLeft = (x0),      \
  82.                             ((PRECTL)(prect))->yBottom = (y0),    \
  83.                             ((PRECTL)(prect))->xRight = (x1),     \
  84.                             ((PRECTL)(prect))->yTop = (y1))
  85. // shifts the coordinates of a rectangle by dx, dy pixels
  86. #define RectShift(prect, dx, dy)                                  \
  87.                            (((PRECTL)(prect))->xLeft += (dx),     \
  88.                             ((PRECTL)(prect))->yBottom += (dy),   \
  89.                             ((PRECTL)(prect))->xRight += (dx),    \
  90.                             ((PRECTL)(prect))->yTop += (dy))
  91.                             
  92.                         
  93. #endif // #i            fndef _APIEX_PM_H_
  94.