home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / source / bento / headers / plfmtype.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-02  |  10.7 KB  |  364 lines

  1. /*
  2.     File:        PlfmType.h
  3.  
  4.     Contains:    Platform-specific Types
  5.  
  6.     Written by:    Vincent Lo
  7.  
  8.     Copyright:    ⌐ 1993-94 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.         <35>     2/16/94    JA        Add vanilla XMPPoint, XMPRect structs (cool
  13.                                     methods moved into optional AltPoint.h.)
  14.         <34>     2/15/94    Té        fix 1143649 and some clean up
  15.         <33>      2/7/94    JA        Improved cleanliness 12 ways. (Just minor
  16.                                     tweaks for Tiger Team cleanup.)
  17.         <32>      2/3/94    JA        Changed #include <SysEqu.h> to <LowMem.h>.
  18.                                     Fixed XMPASLMQDGlobals to use
  19.                                     LMGetCurrentA5.
  20.         <31>      2/1/94    JA        Added XMPDouble, XMPExtended. Added include
  21.                                     of PlfmDef.h. Removed some obsolete unused
  22.                                     typedefs.
  23.         <30>     1/31/94    JA        Moved QuickDraw.h "frame" fix to separate
  24.                                     QDFix.h to allow for separate
  25.                                     precompilation.
  26.         <29>     1/26/94    RR        Added XMPIdleFrequency
  27.         <28>     1/21/94    CC        Replaced XMPTimeStamp and kTimeUnknown with
  28.                                     XMPChangeID and kXMPUnknownChange.
  29.         <27>     1/21/94    CG        Typedefed XMPContainerSuite.
  30.         <26>     1/17/94    NP        Removed XMPEventHandlerProcPtr.
  31.         <25>     1/14/94    CC        Added type XMPTimeStamp and constant
  32.                                     kTimeUnknown.
  33.         <24>     1/10/94    NP        Redefined XMPIText.
  34.         <23>    12/16/93    Té        added typedef for XMPEditor
  35.         <22>    12/10/93    CG        Added typedef for XMPClassID.
  36.         <21>     12/7/93    NP        Added XMPASLMQDGlobals macro. Added
  37.                                     kXMPFalse, kXMPTrue and kXMPNULL.
  38.         <20>     12/3/93    Té        moved definition of XMPIText from
  39.                                     XMPTypes.h to here
  40.         <19>     12/2/93    RR        Added events to distinguish between click
  41.                                     in border and click in embedded frame
  42.         <18>    11/30/93    JA        Added fix to keep QuickDraw.h from defining
  43.                                     a "frame" constant (see details below.)
  44.         <17>    11/23/93    VL        Added prototype for global operator new.
  45.         <16>    11/19/93    RR        Added event contstants mouseDownEmbedded,
  46.                                     mouseUpEmbedded, Menu and Window
  47.         <15>     10/6/93    JA        Moved XMPPoint to new "Point.h". Removed
  48.                                     unused XMPRectangle.
  49.         <14>     9/24/93    PH        Make XMPPaltformType be XMPOSType
  50.         <13>     9/16/93    CC        Added XMPPlatformType╔void*, of course!
  51.         <12>     9/16/93    JA        Changed XMPPlatformShape to --you guessed
  52.                                     it-- void*.
  53.         <11>     9/15/93    RR        Added XMPCommandID and XMPMenuItemID
  54.         <10>     9/10/93    RR        Updated definitions for menu types
  55.          <9>      9/7/93    jpa        Changed XMPPlatformTransform to a simple, tasteful void*.
  56.          <8>      6/2/93    NP        Synced with Prototype version.
  57.          <7>      5/4/93    NP        _PLFMTYPES_ -> _PLFMTYPE_
  58.          <6>     4/29/93    VL        8.3 Name Change.
  59.          <5>     4/28/93    Té        add FindWindow partCode constants
  60.          <4>     4/27/93    Té        add event constants
  61.          <3>     4/19/93    JBS        change XMPShapeData to XMPPlatformShape
  62.          <2>     4/15/93    VL        Added XMPScriptCode for files.
  63.          <1>      4/6/93    VL        first checked in
  64.  
  65.     To Do:
  66.         1) What about Handle?
  67.     
  68.     In Progress:
  69.         jpa        Moved XMPFileRefNum here from NamSpace.h.
  70.                 Added #include of <stdlib.h>.
  71. */
  72.  
  73. #ifndef _PLFMTYPE_
  74. #define _PLFMTYPE_
  75.  
  76.  
  77. // JPA: Moved QD fix to QDFix.h to allow precompilation of Toolbox headers w/o PlfmType.h.
  78.  
  79. #ifndef __QDFIX__
  80. #include "QDFix.h"
  81. #endif
  82.  
  83. #ifndef _PLFMDEF_
  84. #include "PlfmDef.h"
  85. #endif
  86.  
  87. #ifndef __MEMORY__
  88. #include <Memory.h>
  89. #endif
  90.  
  91. #ifndef __TYPES__
  92. #include <Types.h>
  93. #endif
  94.  
  95. #ifndef __FILES__
  96. #include <Files.h>
  97. #endif
  98.  
  99. #ifndef __WINDOWS__
  100. #include <Windows.h>
  101. #endif
  102.  
  103. #ifndef __MENUS__
  104. #include <Menus.h>
  105. #endif
  106.  
  107. #ifndef __EVENTS__
  108. #include <Events.h>
  109. #endif
  110.  
  111. #ifndef __AEREGISTRY_
  112. #include <AERegistry.h>
  113. #endif
  114.  
  115. #ifndef __LIBRARYMANAGER__
  116. #include <LibraryManager.h>
  117. #endif
  118.  
  119. #ifndef __LIBRARYMANAGERUTILITIES__
  120. #include <LibraryManagerUtilities.h>
  121. #endif
  122.  
  123. #ifndef __LOWMEM__
  124. #include <LowMem.h>                        // New replacement for SysEqu.h
  125. #endif
  126.  
  127. #include <stdlib.h>                        // For size_t type
  128.  
  129. //==============================================================================
  130. // Classes used by this interface
  131. //==============================================================================
  132.  
  133. class XMPPart;
  134.  
  135. //==============================================================================
  136. // Scalar Types
  137. //==============================================================================
  138.  
  139. // Primitive types
  140.  
  141. typedef    Boolean            XMPBoolean;        // boolean value. Do not count on its size.
  142. typedef unsigned char    XMPUByte;        // unsigned >= 8-bit value
  143. typedef char            XMPSByte;        // signed >= 8-bit value
  144. typedef unsigned short    XMPUShort;        // unsigned >= 16-bit value
  145. typedef short            XMPSShort;        // signed >= 16-bit value
  146. typedef unsigned long    XMPULong;        // unsigned >= 32-bit value
  147. typedef signed long        XMPSLong;        // signed >= 32-bit value
  148. typedef    float            XMPFloat;        // Single precision (32-bit) floating point
  149. typedef double            XMPDouble;        // Double-precision (64-bit) floating point
  150. typedef extended        XMPExtended;    // Extended-precision (80 or 96-bit) FP
  151. typedef    Fixed            XMPFixed;        // fixed-point (16.16) value
  152.  
  153. typedef void*            XMPPtr;            // XMP pointer
  154. typedef XMPUByte*        XMPRawPtr;        // generic pointer
  155.  
  156. // OS specific types
  157. //
  158. //    The following typedefs are OS specific. They are put together in this file for the 
  159. //    time being. However, they can be put into separate files if desired. For example,
  160. //    all the primitive types will be put in XMPPlatformMisc.h;
  161. //    all graphics system types will be put in XMPPlatformGraphics.h;
  162. //    all File system types will be put in XMPPlatformFiles.h; and so on.
  163. //    The advantage of splitting them in separate files is the changing one type will not
  164. //    require recompiling all the files which includea XMPTypes.h. Also, there may be a lot
  165. //    of OS-specific types. If that's the case, we don't want them all in one file.
  166. //
  167.  
  168. // Graphics system
  169.  
  170. typedef Region             XMPRegion;
  171. typedef RgnPtr            XMPRgnPtr;    
  172. typedef RgnHandle        XMPRgnHandle;
  173. typedef    void*            XMPPlatformShape;            // Graphics-system-dependent shape data
  174. typedef XMPFixed        XMPCoordinate;                // Graphics coordinates; 16.16 fixed by default
  175.  
  176. typedef struct { XMPFixed m[3][3]; } XMPMatrix;        // Transform matrix for translation, scaling,
  177.                                                     // skewing, rotation or any combination.
  178.                                                     // Same as "mapping" in QuickDraw GX.
  179. typedef void*                XMPPlatformTransform;    // Graphics-system-dependent transform data
  180.  
  181. typedef    XMPSShort            XMPGraphicsSystem;        // Type of graphics system
  182. const    XMPGraphicsSystem    kXMPQuickDraw    = 1;    // Macintosh QuickDraw graphics system
  183. const    XMPGraphicsSystem    kXMPQuickDrawGX    = 2;    // Macintosh QuickDraw GX graphics system
  184.  
  185. // XMPPoint struct. We conditionalize this with a symbol, like the header files, to allow
  186. // alternate definitions to be included first; they can then #define _POINT_ to keep this one
  187. // from being defined here.
  188.  
  189. #ifndef _POINT_
  190. #define _POINT_
  191.  
  192. struct XMPPoint {                                    // Fixed-point point.
  193.     XMPCoordinate x, y;                                // Identical to "gxPoint" in QD GX.
  194. };
  195.  
  196. #endif //_POINT_
  197.  
  198. // XMPRect struct. We conditionalize this with a symbol, like the header files, to allow
  199. // alternate definitions to be included first; they can then #define _RECT_ to keep this one
  200. // from being defined here.
  201.  
  202. #ifndef _RECT_
  203. #define _RECT_
  204.  
  205. struct XMPRect {
  206.     XMPCoordinate left,  top,                        // Identical to "gxRect" in QD GX.
  207.                   right, bottom;
  208. };
  209.  
  210. #endif //_RECT_
  211.  
  212.  
  213. // File System
  214.  
  215. typedef FSSpec            XMPFileSpec;
  216. typedef ScriptCode        XMPScriptCode;
  217. typedef XMPSShort        XMPFileRefNum;
  218.  
  219.  
  220. // Runtime
  221.  
  222. typedef Handle            XMPHandle;
  223.  
  224. typedef TMemoryPool*        XMPHeap;    
  225.  
  226. typedef ProcessSerialNumber    XMPProcessID;
  227.  
  228. typedef OSType            XMPOSType;
  229.  
  230. // Windows
  231.  
  232. typedef WindowPtr        XMPPlatformWindow;
  233. typedef GrafPtr         XMPPlatformCanvas;
  234.  
  235. // Events
  236.  
  237. typedef XMPUShort         XMPEventType;
  238. typedef EventRecord*     XMPEventData;
  239. typedef XMPULong          XMPIdleFrequency;
  240.  
  241. // Menus
  242.  
  243. typedef MenuHandle        XMPPlatformMenu;    
  244. typedef XMPSShort        XMPMenuID;
  245. typedef XMPSShort        XMPMenuItemID;
  246. typedef XMPSLong        XMPCommandID;
  247. typedef Handle            XMPPlatformMenuBar;
  248.  
  249. // Text
  250.  
  251. //typedef IntlText        XMPIText;
  252. typedef struct
  253. {
  254.     ScriptCode    theScriptCode;
  255.     LangCode    theLangCode;
  256.     XMPULong    textLength;
  257.     char        theText[1];
  258. }
  259. XMPIText;
  260.  
  261. // Semantic Interface
  262.  
  263. typedef Handle            XMPIcon;
  264. typedef Handle            XMPSound;
  265.  
  266. typedef AEDesc            XMPObjectSpec;
  267.  
  268.  
  269. // Data Translation
  270.  
  271. typedef XMPOSType    XMPPlatformType;        // Host platform file & data type
  272.  
  273. typedef struct
  274. {
  275.     char    privates[76];
  276.     long    randSeed;
  277.     BitMap    screenBits;
  278.     Cursor    arrow;
  279.     Pattern    dkGray;
  280.     Pattern    ltGray;
  281.     Pattern    gray;
  282.     Pattern    black;
  283.     Pattern    white;
  284.     GrafPtr    thePort;
  285. }
  286. XMPQDGlobalRec;
  287.  
  288.  
  289. // Name Binding
  290.  
  291. typedef const char* XMPEditor;            // An opaque type identifying a specific part editor
  292. typedef const char* XMPContainerSuite;    // An opaque type identifying a specific container suite
  293.  
  294.  
  295. // Data Interchange
  296.  
  297. typedef XMPULong XMPChangeID;            // Content change IDs
  298.  
  299.  
  300. //==============================================================================
  301. // Constants
  302. //==============================================================================
  303.  
  304. #define kXMPNULL NULL
  305.  
  306. const    XMPBoolean    kXMPFalse = 0;
  307. const    XMPBoolean    kXMPTrue = 1;
  308.  
  309. const    XMPMenuID    kXMPAppleMenuID    = 128;
  310. const    XMPMenuID    kXMPFileMenuID    = 129;
  311. const    XMPMenuID    kXMPEditMenuID    = 130;
  312. const    XMPMenuID    kXMPOCEFileMenuID    = 193;
  313. const    XMPOSType    kXMPDASMenuRsrc    = 0x44525652; // 'DRVR';
  314.  
  315. const    XMPChangeID    kXMPUnknownChange = 0;
  316.  
  317. enum {
  318.     kXMPEvtNull         = nullEvent
  319.      ,kXMPEvtMouseDown    = mouseDown
  320.      ,kXMPEvtMouseUp        = mouseUp
  321.      ,kXMPEvtKeyDown        = keyDown
  322.      ,kXMPEvtKeyUp        = keyUp
  323.      ,kXMPEvtAutoKey        = autoKey
  324.      ,kXMPEvtUpdate        = updateEvt
  325.      ,kXMPEvtDisk        = diskEvt
  326.      ,kXMPEvtActivate    = activateEvt
  327.      ,kXMPEvtOS            = osEvt
  328.  
  329. // SHOULD THESE BE OFFICIAL TOOLBOX-DEFINED CONSTANTS?
  330.     
  331.     ,kXMPEvtMenu                 = 98    
  332.     ,kXMPEvtMouseDownEmbedded = 99        // A mouse-down in an embedded frame, or the active border
  333.                                         // Sent to the container
  334.     ,kXMPEvtMouseUpEmbedded   = 100        // A mouse-up in an embedded frame, or the active border
  335.                                         // Sent to the container
  336.     ,kXMPEvtMouseDownBorder      = 101        // A mouse-down in an embedded frame, or the active border
  337.                                         // Sent to the container
  338.     ,kXMPEvtMouseUpBorder     = 102        // A mouse-up in an embedded frame, or the active border
  339.                                         // Sent to the container
  340.     ,kXMPEvtWindow               = 103       // Used to offer events in title bar to root part
  341.                                         // message contains partCode 
  342. };
  343.  
  344. enum {
  345.     kXMPMDInDesk        = inDesk
  346.     ,kXMPMDInMenuBar    = inMenuBar    
  347.     ,kXMPMDInSysWindow    = inSysWindow    
  348.     ,kXMPMDInContent    = inContent    
  349.     ,kXMPMDInDrag        = inDrag    
  350.     ,kXMPMDInGrow        = inGrow    
  351.     ,kXMPMDInGoAway        = inGoAway    
  352.     ,kXMPMDInZoomIn        = inZoomIn    
  353.     ,kXMPMDInZoomOut    = inZoomOut    
  354. };
  355.  
  356. void* operator new(size_t size, XMPHeap heap);
  357.  
  358. #define XMPASLMQDGlobals ( *(XMPQDGlobalRec*)( *(char**)LMGetCurrentA5() \
  359.                             - sizeof(XMPQDGlobalRec) + sizeof(GrafPtr) ) )
  360.  
  361. #define ODVersionString "1.0.0a1"
  362.  
  363. #endif    // _PLFMTYPE_
  364.