//#
//#	File:		ODTypesM.idl
//#
//#	Contains:	Macintosh-specific types and constants
//#
//#	Owned by:	Richard Rodseth
//#
//#	Copyright:	c 1993-94 by Apple Computer, Inc., all rights reserved.
//#
//#	Change History (most recent first):
//#
//#		<38>	11/15/94	NP		1199847-added typeUserToken
//#		<37>	10/11/94	eeh		#1186849: change kODFileMenuID to
//#									kODDocumentMenuID
//#		<36>	 9/23/94	VL		1184166: ContainerName and DocumentName are
//#									ODName (i.e., ODIText).
//#		<35>	 8/28/94	VL		#1182975: Added ODDragResult for DragEnter
//#									& DragWithin.
//#		<34>	 8/19/94	T 		#1159233 Remove references to j3di
//#		<33>	 8/18/94	T 		#1181622 Set Written By: field to Richard
//#		<32>	 8/15/94	DO		Changes for OSA support.
//#		<31>	 7/26/94	eeh		ODQDPoint->Point; add Rect
//#		<30>	 7/21/94	eeh		added kODOCEMailerMenuID
//#		<29>	 7/15/94	jpa		Stop lying to SOM: Define ODQDPoint as a
//#									struct.
//#		<28>	 6/29/94	NP		Added semantic event OSA constants.
//#		<27>	 6/24/94	NP		Added AppleEvent types.
//#		<26>	 6/20/94	T 		moved over lots of constants from the Jdi:
//#									PlfmType.h
//#		<25>	 6/15/94	jpa		Made ODQDPoint an 'unsigned long' so it can
//#									be defined specially in ODTypesF.h.
//#		<24>	 6/14/94	RR		Removed ODHeap
//#		<23>	 6/10/94	CG		Added ODContainerSuite.
//#		<21>	  6/2/94	CC		Added declaration of kODUnknownChange.
//#		<18>	 5/26/94	jpa		Moved imaging stuff to ODTypesB.idl. Added graphics
//#										system constants.
//#		<17>	 5/23/94	RCR		Removed Point and Rect. Made some 4-byte foreign types
//#									into unsigned longs
//#									define and use ODTime2.
//#		<17>	 5/12/94	CC		Temporary workaround for foreign type ODTime:
//#									define and use ODTime2.
//#		<16>	 5/12/94	CC		Added ODLinkInfo, ODPasteAsResult,
//#									ODLinkInfoAction, and ODLinkInfoResult.
//#
//#	To Do:
//#

#ifndef _ODTYPESM_
#define _ODTYPESM_

#define _PLATFORM_MACINTOSH_

/*
#pragma somemittypes off
#include <somobj.idl>	//# for SOMFOREIGN
*/

// Four-byte platform-specific types. These are defined as unsigned long, 
// rather than 
// foreign, so that they can be marshalled. They are not emitted however,
// so that the actual type definitions in ODTypesF.h are used, so that type
// casting is not necessary where these types are used.

typedef unsigned long ODPlatformCanvas;
typedef unsigned long ODRgnPtr;
typedef unsigned long ODRgnHandle;
typedef unsigned long ODPlatformShape;  	  // Graphics-system-dependent shape data
typedef unsigned long ODPlatformTransform;  // Graphics-system-dependent transform data
typedef unsigned long ODgxShape;
typedef unsigned long ODOSType;
typedef unsigned long ODPlatformWindow;
typedef unsigned long ODPlatformMenu;
typedef unsigned long ODPlatformMenuBar;
typedef unsigned long ODPlatformType;    	// Host platform file & data type

typedef struct tagPOINT {		// This is a QuickDraw "Point" structure.
	long x;			// It's 32 bits, but still a struct, and for things to work
	long y;			// at runtime, SOM has to _know_ that it's really a struct.
} POINT;						// ("Don't fool SOM!" --Erik Eidt)               --jpa

typedef struct tagRECT {		// This is a QuickDraw "Rect" structure.
	long top;
	long left;
	long bottom;
	long right;
} RECT;					

typedef void* 	HGLOBAL;

// End of four-byte platform types

#ifdef __SOMIDL__
#ifdef EMIT_GLOBAL_TYPES
#pragma somemittypes on
#endif
#endif


#ifndef _ODTYPESB_
#include "ODTypesB.idl"
#endif

#ifdef _PLATFORM_MACINTOSH_

//==============================================================================
// Scalar Types
//==============================================================================


//
// ODForeign is used for any 4 byte thing that is platform dependent.
//

//# typedef SOMFOREIGN ODForeign; 		// $$$$$ SOMFOREIGN is defined in somobj.idl
										// somobj.xh doesn't get included in ODTypesM.xh

#ifdef __SOMIDL__
  typedef void* ODForeign;
#else
  typedef unsigned long ODForeign;
#endif /* __SOMIDL__ */

typedef HGLOBAL       ODHandle;

// typedef ODULong       OSType;

typedef ODULong	ODDescType;

// Types added for OSAObject support

typedef ODULong  ODScriptingSubType;
typedef ODULong  ODScriptingConnection;
typedef ODULong  ODOSAID;

//typedef ODDesc		ODObjectSpec;

//typedef ODDesc		ODAddressDesc;

//typedef ODDesc		ODDescList;

//typedef	ODRecord	ODAppleEvent;

typedef ODSLong		ODSendMode;
typedef ODSShort	ODSendPriority;

typedef	ODULong		ODEventClass;
typedef	ODULong		ODEventID;

//typedef ODULong       AEKeyword;

//typedef ODSLong       AEEventID;

//typedef void* CallbackCallerProc;

// OS specific types
//
//  The following typedefs are OS specific. They are put together in this file for the
//  time being. However, they can be put into separate files if desired. For example,
//  all the primitive types will be put in ODPlatformMisc.h;
//  all graphics system types will be put in ODPlatformGraphics.h;
//  all File system types will be put in ODPlatformFiles.h; and so on.
//  The advantage of splitting them in separate files is the changing one type will not
//  require recompiling all the files which includea ODTypes.h. Also, there may be a lot
//  of OS-specific types. If that's the case, we don't want them all in one file.
//

// Text

typedef short ODScriptCode; 
typedef short ODLangCode; 

struct ODIText {
	ODScriptCode theScriptCode;
	ODLangCode	 theLangCode;
	ODByteArray	 theText;
};

typedef ODIText ODName; 
typedef ODName ODContainerName;
typedef ODName ODDocumentName;

// Imaging

typedef ODForeign    ODRegion;
#pragma modifier ODRegion: impctx = OPENDOC;

// File System

typedef ODForeign     ODFileSpec;
#pragma modifier ODFileSpec: impctx=OPENDOC;

typedef ODForeign	  ODFileRefNum;
#pragma modifier ODFileRefNum: impctx=OPENDOC;

// Runtime

typedef ODForeign     ODProcessID; // $$$$$ Should be 64 bits
#pragma modifier ODProcessID: impctx = OPENDOC;


// Events

typedef ODUShort     ODEventType;

#ifdef PLATFORM_MACINTOSH
struct ODEventData {
	short						what;
	long						message;
	long						when;
	Point						where;
	short						modifiers;
};
#endif

//bgn#ifdef PLATFORM_WINDOWS
struct ODEventData {
    void* 			hwnd;
    unsigned long	message;
    unsigned long wParam;
    unsigned long lParam;
    unsigned long time;
    POINT 			pt;
};
//bgn#endif

typedef ODEventData EventRecord;

typedef ODULong  		ODIdleFrequency;


typedef ODForeign			ODTime;
//bgn#pragma modifier ODTime: impctx = "OPENDOC";
#pragma modifier ODTime: impctx="OPENDOC";

// Menus

typedef ODSLong	ODMenuID;
typedef ODSLong	ODMenuItemID;
typedef ODSLong	ODCommandID;


// Semantic Interface


//typedef ODForeign   ODObjectSpec; //# $$$$ Do as a sequence?
//#pragma modifier ODObjectSpec: impctx = OPENDOC;

//typedef ODForeign ODOSLToken;
//#pragma modifier ODOSLToken: impctx = OPENDOC;

const ODDescType	cPart = 0x70617274; // 'part'
const ODDescType	cDraft = 0x64726674; // 'drft'

const ODDescType	typeUserToken = 0x746F6B6E; // 'tokn'

// for part info dialog properties
const ODDescType	kODPCategory = 0x63617465; // 'cate'
const ODDescType	kODPSize = 0x73697A65; // 'size'
const ODDescType	kODPCreationDate = 0x63726474; // 'crdt'
const ODDescType	kODPModDate = 0x6D6F6474; // 'modt'
const ODDescType	kODPAuthor = 0x61757468; // 'auth'
const ODDescType	kODPIcon = 0x69636F6E; // 'icon'
const ODDescType	kODPName = 0x706E616D; // 'pnam'
const ODDescType	kODPKind = 0x706B6E64; // 'pknd'
const ODDescType	kODPEditor = 0x65647472; // 'edtr'
const ODDescType	kODPComments = 0x636D6E74; // 'cmnt'
const ODDescType	kODPView = 0x76696577; // 'view'
const ODDescType	kODPIsFrozen = 0x66727A6E; // 'frzn'


// Name Binding

typedef char* ODEditor;    // An opaque type identifying a specific part editor
typedef char* ODContainerSuite;  // An opaque type identifying a specific container suite

typedef ODULong ODChangeID;			// Content change IDs
	// $$$$$ Added RCR
	
typedef ODULong	ODDraftKey;
	// $$$$$ Added RCR

// Drag and Drop

typedef ODBoolean ODDragResult;

// Link Protocol

typedef ODTime ODTime2; //#$$$$$ Workaround for emitter bug
struct ODLinkInfo
{
	ODType			kind;
	ODULong			size;
	ODTime2			creationTime;
	ODTime2			changeTime;
	ODChangeID		change;
	ODBoolean		autoUpdate;
};

// Link Dialogs

struct ODPasteAsResult
{
	ODBoolean		pasteLinkSetting;
	ODBoolean		autoUpdateSetting;
	ODBoolean		mergeSetting;
	ODTypeToken		selectedView;
	ODType			selectedKind;
	ODType			translateKind;
};

enum ODLinkInfoAction
{
	kODLinkInfoCancel,	// = 0 
	kODLinkInfoOk,
	kODLinkInfoBreakLink,
	kODLinkInfoUpdateNow,
	kODLinkInfoFindSource
};

struct ODLinkInfoResult
{
	ODLinkInfoAction	action;
	ODBoolean			autoUpdate;
};

//==============================================================================
// Constants
//==============================================================================


const  ODBoolean  kODFalse = 0;
const  ODBoolean  kODTrue = 1;

const  ODMenuID  kODAppleMenuID  = 128;
const  ODMenuID  kODDocumentMenuID  = 129;
const  ODMenuID  kODEditMenuID	= 130;
const  ODMenuID  kODOCEFileMenuID	= 193;
const  ODMenuID  kODOCEMailerMenuID	= 194;
const  ODOSType  kODDASMenuRsrc	= 0x44525652; // 'DRVR';

#ifdef PLATFORM_MACINTOSH
const  ODGraphicsSystem	kODQuickDraw	= 1; // Macintosh QuickDraw graphics system
const  ODGraphicsSystem kODQuickDrawGX	= 2; // Macintosh QuickDraw GX graphics system
#endif
const  ODGraphicsSystem kODWindows	= 1; // Macintosh QuickDraw GX graphics system

const  ODChangeID  kODUnknownChange = 0;

#ifdef PLATFORM_MACINTOSH
const  ODSShort	kODEvtNull 			= 0; // T : 0-15 copied from Macintosh: <Events.h>
const  ODSShort	kODEvtMouseDown		= 1;
const  ODSShort	kODEvtMouseUp		= 2;
const  ODSShort	kODEvtKeyDown		= 3;
const  ODSShort	kODEvtKeyUp			= 4;
const  ODSShort	kODEvtAutoKey		= 5;
const  ODSShort	kODEvtUpdate		= 6;
const  ODSShort	kODEvtDisk			= 7;
const  ODSShort	kODEvtActivate		= 8;
const  ODSShort	kODEvtOS			= 15;
#endif

// copied from <WinUser.h>
const  ODSShort	kODEvtNull 			= 0x0000; // WM_NULL
const  ODSShort	kODEvtMouseDown	= 0x0201; // WM_LBUTTONDOWN
const  ODSShort	kODEvtMouseUp		= 0x0202; // WM_LBUTTONUP
const  ODSShort	kODEvtKeyDown		= 0x0100; // WM_KEYDOWN
const  ODSShort	kODEvtKeyUp			= 0x0101; // WM_KEYUP
const  ODSShort	kODEvtAutoKey		= 5;
const  ODSShort	kODEvtUpdate		= 0x000F; // WM_PAINT
const  ODSShort	kODEvtDisk			= 7;
const  ODSShort	kODEvtActivate		= 0x0006; // WM_ACTIVATE
const  ODSShort	kODEvtOS			   = 15;
	
const  ODSShort	kODEvtMenu			= 0x0111; // WM_COMMAND
const  ODSShort	kODEvtMouseDownEmbedded = 99;	
										// A mouse-down in an embedded frame, or the active border
										// Sent to the container
const  ODSShort	kODEvtMouseUpEmbedded = 100;
										// A mouse-up in an embedded frame, or the active border
										// Sent to the container
const  ODSShort	kODEvtMouseDownBorder = 101;
										// A mouse-down in an embedded frame, or the active border
										// Sent to the container
const  ODSShort	kODEvtMouseUpBorder	= 102;
										// A mouse-up in an embedded frame, or the active border
										// Sent to the container
const  ODSShort	kODEvtWindow 		= 103;
										// Used to offer events in title bar to root part
const  ODSShort	kODEvtMouseDblClkEmbedded = 104;	
										// A mouse-DblClk in an embedded frame, or the active border
										// Sent to the container


const  ODSShort	kODMDInDesk			= 0; // T : 0-8 copied from Macintosh: <Windows.h>
const  ODSShort	kODMDInMenuBar		= 1;
const  ODSShort	kODMDInSysWindow	= 2;
const  ODSShort	kODMDInContent		= 3;
const  ODSShort	kODMDInDrag			= 4;
const  ODSShort	kODMDInGrow			= 5;
const  ODSShort	kODMDInGoAway		= 6;
const  ODSShort	kODMDInZoomIn		= 7;
const  ODSShort	kODMDInZoomOut		= 8;



#ifdef __SOMIDL__
#ifdef EMIT_GLOBAL_TYPES
#pragma somemittypes off
#endif
#endif


#endif //# _PLATFORM_MACINTOSH_

module OpenDoc_Global_Types 
{
	const string OpenDoc_Types_Version = "1.0.";
};

#endif  // _ODTYPESM
