home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dokpr1.zip / os2h.h < prev    next >
C/C++ Source or Header  |  1995-10-18  |  9KB  |  321 lines

  1. /**************************************************************************
  2.  *                                                                        *
  3.  *                                                                        *
  4.  *          This code is copyright (c) 1994 & 1995                        *
  5.  *                     Athena Design, Inc.                                *
  6.  *                                                                        *
  7.  *                                                                        *
  8.  *                ALL RIGHTS RESERVED                                     *
  9.  *                                                                        *
  10.  *                                                                        *
  11.  *                                                                        *
  12.  *                                                                        *
  13.  *                                                                        *
  14.  **************************************************************************/
  15.  
  16. /*
  17.     this file includes the OS/2 header files (all of them)
  18.  
  19.     2-12-94 dpp
  20. */
  21.  
  22. #ifndef _MH_OS2_INCLUDED
  23.  
  24. #define _MH_OS2_INCLUDED
  25.  
  26. #ifdef M2Z
  27.  
  28. // let's call HDC's OS2_HDC's because NT calls HPS's HDC's
  29. // #define HDC OS2_HDC
  30.  
  31. #define INCL_WIN
  32. #define INCL_WINATOM
  33. #define INCL_GPI
  34. #define INCL_DOS
  35. #define INCL_ERRORS
  36. #define INCL_DEV
  37. #define INCL_SPL
  38. #define INCL_RXFUNC
  39. #define INCL_RXARI
  40. #define INCL_SPLDOSPRINT
  41. #define INCL_DOSPROCESS
  42.  
  43. extern "C"
  44. {
  45. #include <os2.h>
  46. #include <rexxsaa.h>
  47. }
  48.  
  49. // comment out this line for the commercial build
  50. // Dave, could you add /DMESASEBUGMODE to the icc.exe line of your makefile instead
  51. // of defineing it here
  52. //#define MESADEBUGMODE
  53.  
  54. // do we want to debug locks?
  55. #ifdef    MESADEBUGMODE
  56. //#define DEBUGLOCKS
  57. #endif
  58.  
  59. // do we want to debug DDE?
  60. #ifdef MESADEBUGMODE
  61. // #define DEBUGDDE
  62. #endif
  63.  
  64. #ifdef MESADEBUGMODE
  65. #define ERRORMGR
  66. #endif
  67.  
  68. #ifdef ERRORMGR
  69. #include <errormgr.h>
  70. #endif
  71.  
  72. #define HANDLE void *
  73.  
  74. typedef HPS MGraphPtr;
  75.  
  76. #define MWinReleasePS(a,b)                WinReleasePS(b)
  77. #define GetMenuItemCount(menu)            ((int) WinSendMsg(menu,MM_QUERYITEMCOUNT,0,0))
  78. #define GetMenuItemID(menu,cnt)            ((int) WinSendMsg(menu,MM_ITEMIDFROMPOSITION,MPFROM2SHORT(cnt,0),0))
  79.  
  80. // defines for all the OS/2 defines into Mesa-generic ones...
  81. #define    MESA_SCROLL_LINE_LEFT    SB_LINELEFT
  82. #define    MESA_SCROLL_LINE_RIGHT    SB_LINERIGHT
  83. #define    MESA_SCROLL_SLIDERTRACK    SB_SLIDERTRACK
  84. #define    MESA_SCROLL_PAGE_LEFT    SB_PAGELEFT
  85. #define    MESA_SCROLL_PAGE_RIGHT    SB_PAGERIGHT
  86. #define MESA_SCROLL_SLIDERPOS    SB_SLIDERPOSITION
  87.  
  88. #define    MESA_SCROLL_LINE_UP        SB_LINEUP
  89. #define    MESA_SCROLL_LINE_DOWN    SB_LINEDOWN
  90. #define    MESA_SCROLL_PAGE_UP        SB_PAGEUP
  91. #define    MESA_SCROLL_PAGE_DOWN    SB_PAGEDOWN
  92.  
  93. #define    MESA_SYSTEM_MINIMZE        SC_MINIMIZE
  94. #define    MESA_SYSTEM_MAXIMIZE        SC_MAXIMIZE
  95. #define    MESA_SYSTEM_RESTORE        SC_RESTORE
  96.  
  97. // system id's for the scroll-bar buttons...
  98. #define    MSCROLL_LEFT_UP            SBMP_SBLFARROW
  99. #define    MSCROLL_LEFT_DOWN            SBMP_SBLFARROWDEP
  100. #define    MSCROLL_LEFT_DIS            SBMP_SBLFARROWDIS
  101. #define    MSCROLL_RIGHT_UP            SBMP_SBRGARROW
  102. #define    MSCROLL_RIGHT_DOWN        SBMP_SBRGARROWDEP
  103. #define    MSCROLL_RIGHT_DIS            SBMP_SBRGARROWDIS
  104.  
  105. // window position adjustments
  106. #define    MESA_WINDOW_MINIMIZED    0x01
  107. #define    MESA_WINDOW_MAXIMIZED    0x02
  108. #define    MESA_WINDOW_RESTORED    0x04
  109. #define    MESA_WINDOW_ACTIVATE    0x08
  110. #define    MESA_WINDOW_DEACTIVATE    0x10
  111.  
  112. // ifdef M2Z
  113. #endif
  114.  
  115. #ifdef M2NT
  116.  
  117.  
  118. #include <windows.h>
  119. #include <windowsx.h>
  120.  
  121. // HPS's are really HDC's
  122. #define HPS                 HDC
  123.  
  124. #define MGraphPtr             HPS
  125.  
  126. typedef WINDOWPOS * PSWP;
  127.  
  128. #define MRESULT                LRESULT
  129. #define MPARAM                int
  130. #define PFNWP                WNDPROC
  131. #define PHWND                HWND *
  132. #define HAB                    HANDLE
  133. #define HMQ                    HANDLE
  134. #define SWP                    WINDOWPOS
  135. #define POINTL                POINT
  136. #define PPVOID                void *
  137. #define DATETIME            SYSTEMTIME
  138. #define RECTL                RECT
  139. #define BM_QUERYCHECK        BM_GETCHECK
  140. #define QMSG                MSG
  141. #define SWP_ZORDER            0
  142. #define SWP_ACTIVATE        0
  143. #define SWP_SHOW            0
  144. #define SWP_MOVE            0
  145. #define SWP_SIZE            0
  146. #define    SB_SLIDERTRACK        SB_THUMBTRACK
  147. #define SBM_QUERYPOS        SBM_GETPOS
  148. #define SBM_QUERYRANGE        SBM_GETRANGE
  149. #define MATRIXLF            XFORM
  150. #define FONTMETRICS            TEXTMETRIC
  151.  
  152. // keyboard virtual key remapping
  153. #define VK_ESC                VK_ESCAPE
  154. #define VK_BACKTAB            VK_BACK
  155. #define VK_ALT                VK_MENU
  156. #define VK_CTRL                VK_CONTROL
  157. #define VK_PAGEDOWN            VK_NEXT
  158. #define VK_PAGEUP            VK_PRIOR
  159. #define VK_ENTER            VK_RETURN
  160. #define VK_NEWLINE            VK_EXECUTE
  161.  
  162. // Message mapping
  163. #define WM_BUTTON1DOWN        WM_LBUTTONDOWN
  164.  
  165. // THESE are total Hacks
  166. // FIXMENT
  167. #define KC_SHIFT            MK_SHIFT
  168. #define KC_CTRL                MK_CONTROL
  169. #define KC_ALT                0
  170. #define KC_CHAR                0
  171. #define KC_KEYUP            0
  172. #define KC_VIRTUALKEY        0
  173. #define WM_HELP                0
  174.  
  175. // FIXMENT
  176. #define SPBM_QUERYVALUE        10
  177. #define SPBM_SETCURRENTVALUE        10
  178. #define SPBQ_UPDATEIFVALID    10
  179. #define LM_QUERYSELECTION    10
  180. #define LIT_FIRST            10
  181. #define LM_SELECTITEM        10
  182. #define PP_FOREGROUNDCOLOR    1
  183. #define PP_BACKGROUNDCOLOR    2
  184. #define PP_FONTNAMESIZE        3
  185.  
  186. // some functions
  187. #define WinGetPS(x)                             GetDC(x)
  188. #define WinOpenClipbrd(x)                        OpenClipboard(x)
  189. #define WinSetFocus(x,y)                         SetFocus(y)
  190. #define WinIsWindow(x,y)                         IsWindow(y)
  191. #define WinSetWindowULong(x,y,z)                 SetWindowLong((x),(y),(z))
  192. #define WinQueryWindowULong(x,y)                 GetWindowLong((x),(y))
  193. #define DosDelete(x)                             DeleteFile(x)
  194. #define DosMove(x,y)                             MoveFile(x,y)
  195. #define WinPostMsg(a,b,c,d)                     PostMessage(a,b,c,d)
  196. #define WinSendMsg(a,b,c,d)                     SendMessage(a,b,c,d)
  197. #define WinQueryWindowPos(a,b)                    GetWindowPlacement(a,b)
  198. #define WinInvalidateRect(a,b,c)                InvalidateRect(a,b,c)
  199. #define WinQueryWindowTextLength(a)                GetWindowTextLength(a)
  200. #define WinQueryWindowText(a,b,c)                GetWindowText(a,c,b)
  201. #define WinSetWindowText(a,b)                    SetWindowText(a,b)
  202. #define DosBeep(a,b)                            Beep(a,b)
  203. #define WinUpdateWindow(a)                        UpdateWindow(a)
  204. #define WinPeekMsg(a,b,c,d,e,f)                    PeekMessage(b,c,d,e,f)
  205. #define WinGetMsg(a,b,c,d,e)                    GetMessage(b,c,d,e)
  206. #define WinWindowFromID(a,b)                    GetDlgItem(a,b)
  207. #define WinDestroyWindow(a)                        DestroyWindow(a)
  208. #define WinSetCapture(a,b)                        SetCapture(b)
  209. #define MWinReleasePS(a,b)                        ReleaseDC(a,b)
  210. #define WinSetWindowPos(a,b,c,d,e,f,g)            SetWindowPos(a,b,c,d,e,f,g)
  211. #define GpiSetModelTransformMatrix(a,b,c,d)        SetWorldTransform(a,c)
  212. #define GpiQueryModelTransformMatrix(a,b,c)        GetWorldTransform(a,c)
  213. #define GpiSavePS(a)                            SaveDC(a)
  214. #define GpiRestorePS(a,b)                        RestoreDC(a,b)
  215. #define WinMapWindowPoints(a,b,c,d)                MapWindowPoints(a,b,c,d)
  216. #define WinDefWindowProc(a,b,c,d)                DefWindowProc(a,b,c,d)
  217. #define GpiBeginPath(a,b)                        BeginPath(a)
  218. #define GpiEndPath(a)                            EndPath(a)
  219. #define GpiStrokePath(a,b,c)                    StrokePath(a)
  220. #define GpiFillPath(a,b,c)                        FillPath(a)
  221. #define GpiQueryFontMetrics(a,b,c)                GetTextMetrics(a,c)
  222.  
  223. // defines for all the OS/2 defines into Mesa-generic ones...
  224. #define    MESA_SCROLL_LINE_LEFT    SB_LINELEFT
  225. #define    MESA_SCROLL_LINE_RIGHT    SB_LINERIGHT
  226. #define    MESA_SCROLL_SLIDERTRACK    SB_SLIDERTRACK
  227. #define    MESA_SCROLL_PAGE_LEFT    SB_PAGELEFT
  228. #define    MESA_SCROLL_PAGE_RIGHT    SB_PAGERIGHT
  229.  
  230. #define    MESA_SCROLL_LINE_UP        SB_LINEUP
  231. #define    MESA_SCROLL_LINE_DOWN    SB_LINEDOWN
  232. #define    MESA_SCROLL_PAGE_UP        SB_PAGEUP
  233. #define    MESA_SCROLL_PAGE_DOWN    SB_PAGEDOWN
  234.  
  235. #define    MESA_SYSTEM_MINIMZE        SC_MINIMIZE
  236. #define    MESA_SYSTEM_MAXIMIZE        SC_MAXIMIZE
  237. #define    MESA_SYSTEM_RESTORE        SC_RESTORE
  238.  
  239.  
  240. inline PFNWP WinSubclassWindow(HWND hw,PFNWP wp)
  241. {
  242.     PFNWP old;
  243.     
  244.     old = (PFNWP) GetWindowLong(hw,GWL_WNDPROC);
  245.     SetWindowLong(hw,GWL_WNDPROC,(int) wp);
  246.     return old;
  247. }
  248.  
  249. // FIXMENT - stub functions
  250. extern HWND WinLoadMenu(HWND,int,int);
  251.  
  252. #define SHORT1FROMMP(a)     HIWORD(a)
  253. #define SHORT2FROMMP(a)        LOWORD(a)
  254. #define LOUSHORT(a)            LOWORD(a)
  255. #define MPFROM2SHORT(a,b)     MAKELONG(a,b)
  256. #define MPFROMLONG(a)        ((int) (a))
  257. // ifdef M2NT
  258. #endif
  259.  
  260. // do some header file stuff to make the Mac work more like OS/2
  261. // 95-07-10 dpp
  262. #ifdef M2MAC
  263. #pragma once
  264.  
  265. class LView;
  266.  
  267. #define ULONG unsigned long
  268. typedef LView * HWND;
  269. // #define HWND LView *
  270. #define MGraphPtr GrafPtr
  271.  
  272. #include <LApplication.h>
  273. #include <LWindow.h>
  274. #include <PP_Messages.h>
  275. #include <PP_Resources.h>
  276. #include <URegistrar.h>
  277. #include <PPobClasses.h>
  278. #include <LGrowZone.h>
  279. #include <UMemoryMgr.h>
  280. #include <UPowerTools.h>
  281. #include <LEditField.h>
  282.  
  283. // the scroll functionality -- FIXMEMAC
  284. #define    MESA_SCROLL_LINE_LEFT    1
  285. #define    MESA_SCROLL_LINE_RIGHT    2
  286. #define    MESA_SCROLL_SLIDERTRACK    3
  287. #define    MESA_SCROLL_PAGE_LEFT    4
  288. #define    MESA_SCROLL_PAGE_RIGHT    5
  289.  
  290. #define    MESA_SCROLL_LINE_UP        1
  291. #define    MESA_SCROLL_LINE_DOWN    2
  292. #define    MESA_SCROLL_PAGE_UP        4
  293. #define    MESA_SCROLL_PAGE_DOWN    5
  294.  
  295. #define    MESA_SYSTEM_MINIMZE        1
  296. #define    MESA_SYSTEM_MAXIMIZE    2
  297. #define    MESA_SYSTEM_RESTORE        3
  298.  
  299. // FIXMEMAC
  300. #define KC_SHIFT            1
  301. #define KC_CTRL                2
  302. #define KC_ALT                0
  303. #define KC_CHAR                0
  304. #define KC_KEYUP            0
  305. #define KC_VIRTUALKEY        0
  306. #define WM_HELP                0
  307.  
  308. #define theHAB                0
  309. #define TheMesaHAB            0
  310. #define DosBeep(a,b)
  311.  
  312. //#ifdef M2MAC
  313.  
  314. #endif
  315.  
  316. // OS/2 included
  317.  
  318. #endif
  319.  
  320.  
  321.