/* @(#)Z 1.42 com/src/include/c/ODTypesF.h, odcore, od96nt, odnt9712d 97/03/21 16:50:27 (97/01/22 16:55:27) */
/*====START_GENERATED_PROLOG======================================
 */
/*
 *   COMPONENT_NAME: odcore
 *
 *   CLASSES: none
 *
 *   ORIGINS: 82,27
 *
 *
 *   (C) COPYRIGHT International Business Machines Corp. 1995,1996
 *   All Rights Reserved
 *   Licensed Materials - Property of IBM
 *   US Government Users Restricted Rights - Use, duplication or
 *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
 *   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 *   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 *   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 *   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
 *   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
 *   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
 *   OR PERFORMANCE OF THIS SOFTWARE.
 */
/*====END_GENERATED_PROLOG========================================
 */

/*
        File:           ODTypesF.h

        Contains:       Definitions for Foreign types which can't be described in IDL

        Owned by:       Richard Rodseth

        Copyright:      c 1994 - 1995 by Apple Computer, Inc., all rights reserved.

        Change History (most recent first):

          Defect  Date   Body  Reason
          ------ ------- ----  -------------------------------------------------------
           23372 6/20/96  BRR  Move def of ACCEL struct to only be included for AIX
           23278 6/18/96  BRR  Add _PLATFORM_AIX_ to all ACCEL definitions
           23129 6/13/96  BRR  Add _PLATFORM_AIX_ definition for HWND
           22750 6/10/96  BRR  Add _PLATFORM_AIX_ flags
           21029 4/11/96  LAW  Add _PLATFORM_OS2_ and _PLATFORM_AIX_ flags
           20821 4/05/96  LAW  Fixed typedef of OSType and associated typedefs
           20780 3/28/96  BRR  Added definition for ODPlatformAccelTable
           20444 3/16/96  BRR  Added definition for ODACCELTABLE
           20259 3/08/96  BRR  Added MenuBar stuff in that was added to ODTypesM.idl

                 <4>      9/8/95        VL              1275241, 1283463: Added
                                                                        ODPlatformDragReference.
                 <3>     5/25/95        jpa             Don't include GX header(s) [1253324]
                 <2>     3/22/95        jpa             Added ODPlatformPrintJob. [1230236]
                 <1>     1/25/95        jpa             first checked in
                                                                 ---Moved to ODSOM:Interfaces:Handmade:
                <12>     1/22/95        NP              Add ODHandle.
                <11>    11/30/94        RR              #1188078 Removed unused and inappropriate
                                                                                                                                                types
                <10>     9/23/94        RR              Removed forward declaration of ODPart
                 <9>     8/18/94        TE              #1181622 Set Richard to the Owned by:
                                                                        field
                 <8>     7/26/94        eeh             remove typedef of ODQDPoint
                 <7>     7/19/94        jpa             Include QDFixM.h.
                 <6>     6/20/94        TE              Added ODQDGlobalRec
                 <5>     6/15/94        jpa             Added ODQDPoint definition.
                 <4>     6/13/94        NP              Added comment after endif
                 <3>      6/7/94        CG              Commented out def for GetIndString.
                 <2>     5/23/94        RR              Added ODPlatformType
                 <2>      4/4/94        RR              XMP -> OD

        In Progress:

*/

#ifndef _ODTYPESF_
#define _ODTYPESF_

/*
        This is a hand-made file, containing Macintosh "foreign" types, which cannot be defined in IDL.
        Actually, all of them are 4-byte types which are defined in ODTypesM.idl as "unsigned long"
        rather than as foreign, and are not emitted. This means that they can be marshalled, and
        can be used without typecasting, since the actual definition is obtained from this file.

        This file is included in ODObject.h by way of  a "passThru" statement in ODObject.idl
*/

#ifdef _PLATFORM_MACINTOSH_  // we don't want to include these for _PLATFORM_WIN32_
#ifndef __TYPES__
#include <Types.h>
#endif

#ifndef __FILES__
#include <Files.h>
#endif

#ifndef _QDFIXM_
#include <QDFixM.h>
/*
        This header fixes problems with the incorrect use of the 'frame'
        constant defined in QuickDraw.h ... see comments in QDFixM.h for details.
*/
#endif

#ifndef __QUICKDRAW__
#include <QuickDraw.h>
#endif

#ifndef __WINDOWS__
#include <Windows.h>
#endif

#ifndef __MENUS__
#include <Menus.h>
#endif

#ifndef __AEREGISTRY__
#include <AERegistry.h>
#endif

#ifndef __APPLEEVENTS_
#include <AppleEvents.h>
#endif

#ifndef __EVENTS__
#include <Events.h>
#endif

#ifndef __FIXMATH__
#include <FixMath.h>                    // Must include before GX headers...
#endif

#ifndef __DRAG__
#include <Drag.h>
#endif

//#ifndef __GXTYPES__
//#include <GXTypes.h>                  /* for gxShape type */
//#endif
#endif // _PLATFORM_MACINTOSH_

#ifdef _PLATFORM_WIN32_
#include <WTYPES.h>
#endif
#ifdef _PLATFORM_OS2_
#include <ODos2.h>
#endif
#ifdef _PLATFORM_UNIX_
#include <X11/Intrinsic.h>
                // Intrinsic.h already has a definition for Boolean
#define _BooleanType
#include <Xm/XmAll.h>
#endif

/* Definitions of 4-byte types defined in ODTypesM.idl, but not emitted */

#ifdef _PLATFORM_MACINTOSH_
typedef GrafPtr ODPlatformCanvas;    // But it's a gxViewPort for QuickDraw GX
#endif


typedef void*                   ODPlatformPrintJob;
#if defined(_PLATFORM_WIN32_) || defined (_PLATFORM_OS2_)
typedef HRGN                    ODPlatformShape;        // Graphics-system-dependent shape data
#elif _PLATFORM_UNIX_
typedef Region                  ODPlatformShape;
#else
typedef void*                   ODPlatformShape;        // Graphics-system-dependent shape data
#endif
typedef void*                   ODPlatformTransform;    // Graphics-system-dependent transform data


#ifdef _PLATFORM_MACINTOSH_
typedef RgnHandle               ODRgnHandle;
#endif
#if defined(_PLATFORM_WIN32_) || defined (_PLATFORM_OS2_)
typedef HRGN            ODRgnHandle;
#endif
#if defined(_PLATFORM_UNIX_)
typedef Region  ODRgnHandle;
#endif


#ifdef _PLATFORM_MACINTOSH_
typedef struct gxPrivateShapeRecord *ODgxShape; // Makes it synonymous with gxShape type
#endif
#if defined(_PLATFORM_WIN32_) || defined(_PLATFORM_OS2_) || defined(_PLATFORM_UNIX_)
typedef void* ODgxShape;        // Makes it synonymous with gxShape type
#endif

#ifdef _PLATFORM_UNIX_
typedef Window          WindowPtr;
typedef Window          ODPlatformWindow;
typedef Window          HWND; // This is temporary for build purposes - BOGUS
typedef unsigned long   HACCEL; // Lance, check into this -- BOGUS ALERT

struct ACCEL{
   unsigned short fs;
   unsigned short key;
   unsigned short cmd;
};

#endif


#ifdef _PLATFORM_MACINTOSH_
typedef WindowPtr       ODPlatformWindow;
#endif
#if defined(_PLATFORM_WIN32_) || defined(_PLATFORM_OS2_)
typedef HWND            WindowPtr;
typedef HWND            ODPlatformWindow;
#endif


#ifdef _PLATFORM_MACINTOSH_
typedef MenuHandle              ODPlatformMenu;
typedef Handle                  ODPlatformMenuBar;
#endif


#if defined(_PLATFORM_WIN32_) || defined(_PLATFORM_OS2_)
typedef void   *ODMenuTemplate;
typedef HWND    ODPlatformMenuBar;
#endif // PLATFORM_WIN32 || PLATFORM_OS2

#ifdef _PLATFORM_UNIX_
typedef void *ODPlatformMenuBar;
#endif // PLATFORM_UNIX

#if defined(_PLATFORM_WIN32_) || defined(_PLATFORM_OS2_) || defined(_PLATFORM_UNIX_)
typedef HWND    ODPlatformMenu;
typedef HACCEL  ODPlatformAccelTable;
#ifndef INCL_ODDTS
   #include "CmdDefs.xh"
#else
   #include "CmdDefs.hh"
#endif

#define ACCELMAX 20
typedef struct _ODACCEL{
   ACCEL aAccel[ACCELMAX];
} ODACCEL;

typedef struct _ODACCELTABLE{
   unsigned short cAccel;
   unsigned short codepage;
   ACCEL    aaccel[1];
} ODACCELTABLE;
#endif // PLATFORM_OS2 || PLATFORM_WIN32 || PLATFORM_UNIX

#if defined(_PLATFORM_WIN32_)||defined(_PLATFORM_OS2_)||defined(_PLATFORM_UNIX_)
typedef unsigned long OSType; // needed for ODOSType below, LAW 4/05/96
#endif // PLATFORM_OS2 || PLATFORM_WIN32 || PLATFORM_UNIX_

typedef OSType                  ODOSType;
typedef ODOSType        ODPlatformType;    // Host platform file & data type


#ifdef _PLATFORM_MACINTOSH_
typedef Handle                  ODHandle;
#endif
#if defined(_PLATFORM_WIN32_) || defined(_PLATFORM_OS2_) || defined(_PLATFORM_UNIX_)
typedef void **ODHandle;
#endif


#ifdef _PLATFORM_MACINTOSH_
typedef DragReference   ODPlatformDragReference;
#endif
#if defined(_PLATFORM_WIN32_) || defined(_PLATFORM_OS2_) || defined(_PLATFORM_UNIX_)
typedef void*   ODPlatformDragReference;
#endif


#if defined(_PLATFORM_WIN32_) || defined(_PLATFORM_OS2_) || defined(_PLATFORM_UNIX_)
typedef unsigned int OSErr;
typedef char* AEDescList;

typedef unsigned char   Str255[256],
                        *StringPtr;

#ifdef _PLATFORM_WIN32_
typedef POINT Point;

typedef RECT Rect;
#endif
#ifdef _PLATFORM_OS2_
typedef POINTL Point;

typedef RECTL Rect;
#endif
#ifdef _PLATFORM_UNIX_
typedef XPoint Point;

typedef XRectangle Rect;
#endif

struct ProcessSerialNumber {
        unsigned long   highLongOfPSN;
        unsigned long   lowLongOfPSN;
};
typedef struct ProcessSerialNumber ProcessSerialNumber;

#define noErr   0
typedef int*    AliasHandle;
typedef char*   corbastring;
#define fixed1          (0x00010000L)
#define FixedToInt(a) ((short)(((long)(a) + fixed1/2) >> 16))
#define IntToFixed(a) ((long)(a) << 16)
#define ff(a)           IntToFixed(a)

// Registration return and error codes
const long RM_NO_ERROR                       = 0x0000;
const long PR_NO_ERROR                       = 0x0000;
const long CM_NO_ERROR                       = 0x0000;
const long RMANAGER_RM_BASE                  = 0x0000;
const long PARTREGISTRY_PR_BASE              = 0x0000+RMANAGER_RM_BASE;
const long errPR_INVALID_CLASSNAME              = 0x0001+PARTREGISTRY_PR_BASE;
const long errPR_COULD_NOT_LOAD_CLASS           = 0x0002+PARTREGISTRY_PR_BASE;
const long errPR_NOT_PART_HANDLER_CLASS         = 0x0003+PARTREGISTRY_PR_BASE;
const long errPR_PART_HANDLER_INFO_REPLACED     = 0x0004+PARTREGISTRY_PR_BASE;
const long errPR_PART_HANDLER_NOT_FOUND         = 0x0005+PARTREGISTRY_PR_BASE;
const long errPR_PART_KIND_NOT_FOUND            = 0x0006+PARTREGISTRY_PR_BASE;
const long errPR_BUFFER_TOO_SMALL               = 0x0007+PARTREGISTRY_PR_BASE;
// end Registration return and error codes

#endif // _PLATFORM_WIN32_ || _PLATFORM_OS2_ || _PLATFORM_UNIX_

#ifdef _PLATFORM_OS2_
typedef struct WindowSystemDataTag
{
  HAB                  hab;
  ODPlatformWindow     parentWindow;
  PFNWP                windowProc;
  HMODULE              resInstance;
  ODPlatformMenuBar    menu;
  ODPlatformAccelTable accelTable;
  HMQ                  hmq;
} WindowSystemData;
#endif

#ifdef _PLATFORM_WIN32_
typedef struct WindowSystemDataTag
{
  HINSTANCE         instance;
  HINSTANCE         resInstance;
  ODPlatformMenuBar menu;
  HACCEL            accelTable;
  ODPlatformWindow  parentWindow;
  WNDPROC           windowProc;
  /* the following data member is used by the OLE interop code to turn off
   * displaying a window to the screen during certain rendering situations.
   */
  BOOL              showToScreen;
} WindowSystemData;
#endif

#ifdef _PLATFORM_UNIX_
typedef struct WindowSystemDataTag
{
  Display               *display;
  Screen                *screen;
  XtAppContext          appContext;
  Widget                appShell;
  ODPlatformAccelTable  accelTable;
  ODPlatformMenuBar     menu;
  ODPlatformWindow      parentWindow;
  void                  (*closeCallBack)(Widget widget, XtPointer client_data,
                                         XtPointer call_data);
  void                  (*saveYourselfCallBack)(Widget widget,
                                         XtPointer client_data,
                                         XtPointer call_data);
} WindowSystemData;
#endif

#endif // _ODTYPESF_
