#ifdef __PRIVATE__
//#
//#	File:		DrawPart.idl
//#
//#	Contains:	IDL description of DrawPart
//#
//#	Written by:	Eric House
//#
//#	Copyright:	c 1994 by Apple Computer, Inc., all rights reserved.
//#
//#	Change History (most recent first):
//#
//#		<10>	  9/9/94	CG		#1183531: PartWrapper API implementation.
//#		 <9>	  9/8/94	NP		Added private method for embedded frame
//#									iterator.
//#		 <8>	  8/5/94	JBS		#1179151 Part API cleanup
//#		 <7>	  8/3/94	CC		Added fClipboardFocus field. (1160484)
//#		 <6>	  8/1/94	CC		Removed somToken declaration of Rect and
//#									Point; adjusted parameters accordingly.
//#		 <5>	 7/14/94	eeh		"Apple" module name -> "AppleTestDraw"
//#		 <4>	 7/13/94	VL		Moved Release from releaseorder to
//#									override.
//#		 <3>	 7/12/94	eeh		add Externalize
//#		 <2>	 7/11/94	eeh		add MakeEmbeddedFrame (incomplete)
//#		 <1>	  7/6/94	eeh		first checked in
//#
//#	To Do:
//#
#else
//#	Copyright:	c 1993-1994 by Apple Computer, Inc., all rights reserved.
#endif


#ifndef _DRAWPART_
#define _DRAWPART_

#ifndef _PART_
#include "Part.idl"
#endif

interface ODWindow;
interface ODFocusSet;
interface ODFrame;
interface ODMenuBar;
interface ODSemanticInterface;
interface ODSession;
interface ODTransform;
interface DrawPaletteExt;


#ifdef __PRIVATE__
//=====================================================================================
// Implementation Types
//=====================================================================================

typedef somToken OrderedCollection;
//skntypedef somToken DescType;
//skntypedef somToken AEDesc;
//skntypedef somToken TPrPort;
//skntypedef somToken ODUShort;
typedef somToken Proxy;
typedef somToken RgnHandle;
typedef somToken ODIcon;
typedef somToken RGBColor;
typedef somToken CPrint;
typedef somToken DrawShape;
typedef somToken HBITMAP;
typedef somToken HCURSOR;

#endif

module AppleTestDraw
{

interface DrawPart : ODPart
{
#ifdef __PRIVATE__
#ifdef LATER
	ODSemanticInterface GetSemanticInterface();
	ODPart CreateNewPart(in ODULong theClass, in void *theLocation ) ;
#endif
	void SetNewBounds( in ODFrame frame, in RECT r ) ;
	Proxy* ProxyForFrame(in ODFrame frame);
	void UpdateProxyRegion(in Proxy* proxy);
	void CreateProxySelectionBorder(in Proxy* p);
	void InvalidateSelection(in ODFrame frame);
	void ClipEmbeddedFrames(in ODFrame frame);
	void CommonInitDrawPart();
#ifdef PLATFORM_MACINTOSH
	void LoadIcons();
#endif
#ifdef LATER
	void InstallObjectAccessors();
#endif
	OrderedCollection* GetEmbeddedFrames();
	OrderedCollection* GetDisplayFrames();
	Proxy* ProxyForFrameID(in ODID frameID);
	void HighlightSelection(in ODPlatformCanvas hdc);
	void HighlightProxyBorder(in ODPlatformCanvas hdc, in Proxy* p);
	void HighlightContentObject(in ODPlatformCanvas hdc, in Proxy* p);
	void ClipEmbeddedFacets(in ODFacet facet);
	void EmptySelection();
	ODBoolean HandleMouseDown(in ODFacet facet,
							 in ODPoint where,
							 in ODEventData event);
	ODBoolean HandleMouseDownDrag(in ODFacet facet, in Proxy* selection, in ODEventData event);
	ODBoolean HandleMouseDownEdgeResize(in ODFacet facet, in Proxy* selection, in POINT mouse);
	ODBoolean HandleMouseDownCornerResize(in ODFacet facet, in Proxy* selection, in POINT mouse);
	ODBoolean HandleMouseDownInEmbeddedFrame(in ODFacet container,
											in ODFacet facet,
											in ODPoint where,
											in ODEventData event);
	ODBoolean HandleKeyDown(in ODFrame focusFrame, in ODEventData event);
	ODBoolean HandleMenuEvent(in ODFrame focusFrame, in ODEventData event);
	ODBoolean HandlePageSetup(in ODFrame focusFrame);
	ODBoolean HandlePrinting(in ODFrame focusFrame);
	void 	PrintPage(in ODFacet prFacet, in ODUShort page);
	ODBoolean DoCut(in ODFrame frame);
	ODBoolean DoCopy(in ODFrame frame);
	ODBoolean DoPaste(in ODFrame frame);
	ODBoolean DoPasteLink(in ODFrame frame);
	ODBoolean DoClear(in ODFrame frame);
	ODBoolean DoSelectAll(in ODFrame frame);
	void ActivateFrame(in ODFrame frame);
	void DeActivateFrame(in ODFrame frame);
	void ActivatingWindow(in ODFrame frame);
	void DeActivatingWindow(in ODFrame frame);
	void InstallMenus(in ODFrame aFrame);
	void RemoveMenus(in ODFrame aFrame);
	void SetBGColor1(in ODFrame aFrame, in ODUShort whichColor);
	void UserSetBGColor(in ODFrame frame, in ODULong whichColor);
	void SetBGColor2(in ODFrame aFrame, in ODULong whichColor);
	void Embed(in ODUShort item, in ODFrame frame, out ODPart newPart);
#ifdef PLATFORM_MACINTOSH
	void SetGrafPortOrigin(in ODFacet facet);
#endif
	void InvalEmbedFrameAfterResize(in ODFacet facet, in Proxy* selection,
								  in ODShape oldShape, in ODShape newShape,
								  in POINT transOffset);
	RECT* GetSelectionRectLocal(in Proxy* selection);
	void CreatePalette();
	void DestroyPalette();
	void ShowPalette();
	void HidePalette();
	void GetBGColor(in ODUShort whichColor, out ODULong newColor);
	ODFrame MakeEmbeddedFrame(in ODFrame containingFrame, in ODShape frameShape,
			in ODTransform externalTransform, in ODPart embedPart,
			in ODBoolean isOverlaid);
	ODWindow ODCreateWindow(in ODFrame sourceFrame);

	ODULong AddPartsToMenu(in ODPlatformMenu hMenu, in ODULong	firstToken);
//bgn	void SetBGColor( in ODFrame frame,	in ODUShort whichColor);
//bgn	void UserSetBGColor(in ODFrame frame, in ODRGBColor whichColor);
//bgn	void SetBGColor( in ODFrame frame, in ODRGBColor whichColor);
//bgn	void GetBGColor( in ODUShort whichColor, in ODRGBColor newColor);
	void	DrawTarget(in ODFacet facet);

	void MoveSizeShadowWindow(in ODFrame frame);
	ODPlatformWindow CreateShadowWindow(in ODFrame frame, in ODPlatformWindow hParent);
	void CloneTestDrawContent(in ODDraftKey key, in ODStorageUnit toSU, in ODFrame scopeFrame);
	ODULong GetActiveTool();
	DrawShape* PtInDrawShape(in ODPoint aPnt);
	DrawShape* GetSelectedShape();
	DrawPaletteExt GetDrawPaletteExt();

#endif

#ifdef __SOMIDL__
	implementation
	{
		majorversion = 1;
		minorversion = 0;
		
	releaseorder:
	#ifdef __PRIVATE__
#ifdef LATER
		GetSemanticInterface,
#endif
		CreateNewPart ,
		SetNewBounds ,
		ProxyForFrame,
		UpdateProxyRegion,
		CreateProxySelectionBorder,
		InvalidateSelection,
		ClipEmbeddedFrames,
		CommonInitDrawPart,
#ifdef PLATFORM_MACINTOSH
		LoadIcons,
#endif
#ifdef LATER
			InstallObjectAccessors,
#endif
			GetEmbeddedFrames,
			GetDisplayFrames,
			ProxyForFrameID,
			HighlightSelection,
			HighlightProxyBorder,
			HighlightContentObject,
			ClipEmbeddedFacets,
			EmptySelection,
			HandleMouseDown,
		HandleMouseDownDrag,
		HandleMouseDownEdgeResize,
		HandleMouseDownCornerResize,
		HandleMouseDownInEmbeddedFrame,
		HandleKeyDown,
		HandleMenuEvent,
		HandlePageSetup,
		HandlePrinting,
		PrintPage,
			DoCut,
			DoCopy,
			DoPaste,
			DoPasteLink,
			DoClear,
			DoSelectAll,
			ActivateFrame,
		DeActivateFrame,
		ActivatingWindow,
		DeActivatingWindow,
		InstallMenus,
		RemoveMenus,
		SetBGColor1,
		UserSetBGColor,
		SetBGColor2,
		Embed,
		DrawTarget,
#ifdef PLATFORM_MACINTOSH
		SetGrafPortOrigin,
#endif
			InvalEmbedFrameAfterResize,
			GetSelectionRectLocal,
			CreatePalette,
			DestroyPalette,
			ShowPalette,
			HidePalette,
			GetBGColor,
			MakeEmbeddedFrame,
			ODCreateWindow,
		AddPartsToMenu,
		MoveSizeShadowWindow,
		CreateShadowWindow,
		CloneTestDrawContent,
		GetActiveTool,
		PtInDrawShape,
		GetSelectedShape,
		GetDrawPaletteExt;
#else
		reserved1
		,reserved2
		,reserved3
		,reserved4
		,reserved5
		,reserved6
		,reserved7
		,reserved8
		,reserved9
		,reserved10
		,reserved11
		,reserved12
		,reserved13
		,reserved14
		,reserved15
		,reserved16
		,reserved17
		,reserved18
		,reserved19
		,reserved20
		,reserved21
		,reserved22
		,reserved23
		,reserved24
		,reserved25
		,reserved26
		,reserved27
		,reserved28
		,reserved29
		,reserved30
		,reserved31
		,reserved32
		,reserved33
		,reserved34
		,reserved35
		,reserved36
		,reserved37
		,reserved38
		,reserved39
		,reserved40
		,reserved41
		,reserved42
		,reserved43
		,reserved44
		,reserved45
		,reserved46
		,reserved47
		,reserved48
		,reserved49
		,reserved50
		,reserved51
		,reserved52
		,reserved53
		,reserved54
		,reserved55
		,reserved56
		,reserved57
		,reserved58
		,reserved59
		,reserved60,
		,reserved61,
		,reserved62,
		,reserved63,
		,reserved64;
	#endif

	override:
		somInit,
		somUninit,
        FulfillPromise,
        DropCompleted,
        DragEnter,
        DragWithin,
        DragLeave,
        Drop,
        ContainingPartPropertiesChanged,
        GetContainingPartProperties,
        RevealFrame,
        EmbeddedFrameSpec,
        CreateEmbeddedFramesIterator,
        DisplayFrameAdded,
        DisplayFrameRemoved,
        DisplayFrameConnected,
        DisplayFrameClosed,
        AttachSourceFrame,
        FrameShapeChanged,
        ViewTypeChanged,
        PresentationChanged,
		SequenceChanged,
        WritePartInfo,
        ReadPartInfo,
        Open,
        RequestEmbeddedFrame,
        RemoveEmbeddedFrame,
        RequestFrameShape,
        UsedShapeChanged,
        AdjustBorderShape,
        FacetAdded,
        FacetRemoved,
        CanvasChanged,
        GeometryChanged,
        Draw,
        CanvasUpdated,
        HighlightChanged,
        GetPrintResolution,
        CreateLink,
        LinkUpdated,
        RevealLink,
        EmbeddedFrameChanged,
        LinkStatusChanged,
        BeginRelinquishFocus,
        CommitRelinquishFocus,
        AbortRelinquishFocus,
        FocusAcquired,
        FocusLost,
        CloneInto,
        ExternalizeKinds,
		Externalize,
        ChangeKind,
        HandleEvent,
        HandleEventInEmbedded,
        MouseEnter,
        MouseWithin,
        MouseLeave,
        AdjustMenus,
        UndoAction,
        RedoAction,
        DisposeActionState,
        WriteActionState,
        ReadActionState,
        InitPart,
        InitPartFromStorage,
		HasExtension,
		GetExtension,
		Release;

    #ifdef __PRIVATE__
		passthru C_xh = ""
			"class ODFrame ;"
			"class ODTransform ;"
			"class OrderedCollection ;"
			"class DrawShape ;"
			"struct Proxy {"
			"HRGN region;"
			"ODFrame* frame;"
			"ODTransform* transform;"
			"Proxy(ODRgnHandle r, ODFrame* f, ODTransform* t) {region = r; frame = f; transform = t; }"
		"};"
#ifdef PLATFORM_MACINTOSH
		"#include <Printing.h>"
		"#include <Quickdraw.h>";
#endif
		"#include <PrintLib.h>"
		;
#ifdef PLATFORM_MACINTOSH
		passthru C_xih = "class OrderedCollection;"
		"typedef HICON ODIcon;";
#endif

	// instance variables
		OrderedCollection*	fShapes;
		OrderedCollection*	fDisplayFrames;
		OrderedCollection*	fEmbeddedFrames;
		ODID				fWindowID;			// ID of View As Window window
		
		ODULong				fFrameGroupIDCounter;
		POINT				fDragStart;
		
		ODUShort			fDefaultColor; // Initial background color of all display frames
		OrderedCollection*	fContents;
		OrderedCollection*	fSelection;
		
		ODRgnHandle			fSelectRgn;
		ODRgnHandle			fCornerHandleRgn;
		ODRgnHandle			fEdgeHandleRgn;
		
		ODPlatformMenu		fEmbedMenu;
		ODPlatformMenu		fColorMenu;
		ODPlatformMenu		fFrameMenu;
		ODPlatformMenu		fPaletteMenu;
	
#ifdef PLATFORM_MACINTOSH
		ODIcon				fLargeIcons;
		ODIcon				fSmallIcons;
#endif
	
		ODMenuBar			fMenuBar;
		ODFocusSet 			fFocusSet;
		ODTypeToken			fSelectionFocus;
		ODTypeToken			fMenuFocus;
		ODTypeToken			fKeyFocus;
		ODTypeToken			fClipboardFocus;
	
		ODSemanticInterface	fSemtIntf;
	
		ODStorageUnit		fTestDrawSU;
		
		ODPart				fPalette;
		ODBoolean			fPaletteUp;
		ODBoolean			fPaletteWasShown;
		
		ODBoolean			fbDropTarget;
		ODSession			fSession;
		
		ODPartWrapper		fPartWrapper;

		ODUShort			fPartCount;
		ODUShort			fStringIndex;
		ODULong				firstPartToken;
		ODULong				lastPartToken;

    	char  				typeString [1024];
		char 				*typePtr [25];

		ODSShort			fShadowUsage;
		ODPlatformWindow	fShadowWindow;
		CPrint				*fPrinter;	
		HBITMAP				fArrowBmp;
		HBITMAP				fLineBmp;
		HBITMAP				fRectBmp;
		HBITMAP				fRoundRectBmp;
		HBITMAP				fEllipseBmp;
		HBITMAP				fRectFillBmp;
		HBITMAP				fRoundRectFillBmp;
		HBITMAP				fEllipseFillBmp;
		HCURSOR				fSaveCursor;
	#endif

	};
#endif
};

};  //# Module DrawPart

#endif	// _DRAWPART_
