#ifdef __PRIVATE__
//#
//#	File:		DragPart.idl
//#
//#	Contains:	IDL description of DragPart
//#
//#	Written by:	Chris Andrew
//#
//#	Copyright:	c 1994 by Apple Computer, Inc., all rights reserved.
//#	           	c 1995 by Novell Inc., all rights reserved.
//#
//#	Change History (most recent first):
//#
//#	To Do:
//#
#else
//#	Copyright:	c 1993-1994 by Apple Computer, Inc., all rights reserved.
//#	           	c 1995 by Novell Inc., all rights reserved.
#endif

#ifndef _DRAGPART_
#define _DRAGPART_

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

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


#ifdef __PRIVATE__

//# Implementation Types

typedef somToken OrderedCollection;
typedef somToken Proxy;
typedef somToken RgnHandle;
typedef somToken ODIcon;
typedef somToken RGBColor;
typedef somToken HWND;
typedef somToken LPSTR;
typedef somToken DWORD;
typedef somToken LOGFONT;
typedef somToken BOOL;
typedef somToken UINT;
typedef somToken SrceOfLink;
typedef somToken DestOfLink;
typedef somToken UndoInfo;

#endif

interface DragPart : ODPart
{
	//# New methods of DragPart interface

	ODBoolean HandleMenuEvent(in ODFrame focusFrame, in ODEventData event);
	void DragText(in ODFacet facet,in ODEventData event);
	void SelectText(in ODFacet facet,in ODEventData event);
	void InstallMenus(in ODFrame frame);
	void RemoveMenus(in ODFrame frame);
	void SyncMenuBar(in ODFrame frame);
	ODWindow DrgCreateWindow(in ODFrame frame);
	void ActivatingWindow(in ODFrame frame);
	void DeActivatingWindow(in ODFrame frame);
	void Idle(in ODFrame frame);
	void ExternalizeSelection(in ODStorageUnit disu);
	ODBoolean DoCommand(in ODFrame frame, in ODCommandID command);
	ODBoolean DoCut(in ODFrame frame);
	ODBoolean DoCopy(in ODFrame frame);
	ODBoolean DoPaste(in ODFrame frame);
	ODBoolean DoPasteLink(in ODFrame frame);
	void  	   PasteLink(in ODStorageUnit su);
	ODBoolean DoClear(in ODFrame frame);
	ODBoolean DoSelectAll(in ODFrame frame);
	ODBoolean DoSampleTwo(in ODFrame frame);
	ODBoolean DoSampleOne(in ODFrame frame);
	void PushUndoAction(in ODFrame frame, in ODCommandID command, in ODULong start,
						in ODULong end, in ODPtr text, in ODHandle style, in char* mitext);
	void AdjustLinks(in LPSTR start, in LPSTR endOld, in LPSTR endNew);
	void AdjustDstLinks(in LPSTR start, in LPSTR endOld, in LPSTR endNew);
	void AdjustSrcLinks(in LPSTR start, in LPSTR endOld, in LPSTR endNew);
	void CheckDstLinkDeletion(in LPSTR start, in LPSTR endOld);
	void LinkChanged(in SrceOfLink* srcLink);
	void RemoveLinkSpec(in SrceOfLink* srcLink);
	void InstallObjectAccessors();
	LOGFONT	*PickFont(in ODFrame frame, in LOGFONT *logFont);
	ODSemanticInterface GetSemanticInterface();
	int  GetCursorLineNumber();
	int  GetExtent(in ODFrame frame,in LPSTR pText,in char TempChar,out int pCharWidth);
	void PositionCursor(in ODFrame frame, in int x, in int y, in LPSTR pNewCursor);
	LPSTR PositionFromPoint(in ODFrame frame, in int x, in int y,in RECT prc);
	void UpdateAllViews();
	HWND GetMyWindow(in ODFacet facet);
	void CommonInit(in ODPartWrapper partWrapper);
	HGLOBAL TextReAlloc(in HGLOBAL hglbMem, in DWORD cbBytes,in UINT fuFlags);
	void HandleMouseDown(in ODFacet facet, in ODPoint where, in ODEventData event);
	void HandleKeyDown(in ODFrame focusFrame, in ODEventData event);
	ODBoolean ActivateFrame( in ODFrame frame);
	void  DeActivateFrame( in ODFrame frame);
	ODPoint GetAggregateTranslation( in ODFacet facet);
	void MapPoints( out int x, out int y);

	#ifdef __SOMIDL__
	implementation
	{
		majorversion = 1;
		minorversion = 0;
		
		//# Release order of our new methods. Add new methods to the end!
		
		releaseorder:	
			HandleMenuEvent,
			ExternalTransformChanged,
			DragText,
			SelectText,
			InstallMenus,
			RemoveMenus,
			SyncMenuBar,
			DrgCreateWindow,
			ActivatingWindow,
			DeActivatingWindow,
			Idle,
			ExternalizeSelection,
			DoCommand,
			DoCut,
			DoCopy,
			DoPaste,
			DoPasteLink,
			PasteLink,
			DoClear,
			DoSelectAll,
			DoSampleTwo,
			DoSampleOne,
			PushUndoAction,
			AdjustLinks,
			AdjustDstLinks,
			AdjustSrcLinks,
			CheckDstLinkDeletion,
			LinkChanged,
			RemoveLinkSpec,
			InstallObjectAccessors,
			PickFont,
			GetSemanticInterface,
			GetCursorLineNumber,
			GetExtent,
			PositionCursor,
			PositionFromPoint,
			UpdateAllViews,
			GetMyWindow,
			CommonInit,
			TextReAlloc,
			HandleMouseDown,
			HandleKeyDown,
			ActivateFrame,
			DeActivateFrame,
			GetAggregateTranslation,
			MapPoints;

		//# Methods that we are overriding from ODPart

		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,
			ExternalizeKinds,
			ChangeKind,
			HandleEvent,
			HandleEventInEmbedded,
			MouseEnter,
			MouseWithin,
			MouseLeave,
			AdjustMenus,
			UndoAction,
			RedoAction,
			DisposeActionState,
			WriteActionState,
			ReadActionState,
			InitPart,
			InitPartFromStorage,
			Externalize,
			CloneInto;

		#ifdef __PRIVATE__
		passthru C_xh = ""
			"class ODFrame ;"
			"class ODTransform ;"
			"class OrderedCollection ;"
			"class ODLink ;"
			"class ODLinkSource ;"
			""
			"typedef struct DestOfLink"
			"{"
			"	ODLink			*link;"
			"	LPSTR    		start;"
			"	LPSTR    		end;"
			" 	ODChangeID		id;"
			"//	ODLinkInfo		info;"
			"} DestOfLink;"
			""
			"typedef struct SrceOfLink"
			"{"
			"	ODLinkSource*	link;"
			"	LPSTR    		start;"
			"	LPSTR     		end;"
			"} SrceOfLink;"
			""
			"struct UndoInfo"
			"{"
			"	ODFrame*	displayFrame;"
			"	ODCommandID	command;"
			"	ODULong		start;"
			"	ODULong		end;"
			"	ODPtr		text;"
			"	ODHandle	style;"
			"};"
			""
			"typedef struct UndoInfo UndoInfo;"
			"typedef UndoInfo *UndoInfoPtr;"
			""
			"typedef struct WindowOffscreen {"
			"	int		bogus;"
			"} WindowOffscreen;"
			""
			"class DragPartInfoRec"
			"{"
			"public:"
			"	DragPartInfoRec() { fIsActive 		 	= kODFalse;"
			"						fNeedsActivating 	= kODFalse;"
			"					}"
			"	virtual ~DragPartInfoRec() { }"
			"	ODBoolean	fIsActive;			// Does this frame have its focus set?"
			"	ODBoolean	fNeedsActivating;	// Should activate when its window is activated?"
			"};"
			""
			"#define IDM_SAMPLE1	 8000"
			"#define IDM_SAMPLE2  8001"
			"#define IDM_FONT     8011"
			""
			"#define BUF_SIZE 	 0x200"
			"#define ROUND_SIZE(size) ((size & 0xFF00) + 0x200)"
			""
			"/* Flags used in fDrawMode status word"
			" */"
			"#define DRAW_MODE_DEFAULT	0"
			"#define DRAW_MODE_IDLE		1"
			"#define DRAW_MODE_LINE		2"
			""
			"#ifdef _MSC_VER"
			"#define MAKELP(sel, off)    ((void FAR*)MAKELONG((off), (sel)))"
			"#define SELECTOROF(lp)      HIWORD(lp)"
			"#define OFFSETOF(lp)        LOWORD(lp)"
			"#endif	//_MSC_VER"
		;
		#endif

		//# Instance variables

		int				   		fTextSize;
		HGLOBAL            		fTextHandle;
		HGLOBAL            		fStylHandle;
		ODPoint           		fExtTransStore;
		ODSShort          		fLastFont;
		ODSShort          		fLastSize;
		ODBoolean         		fFrameShapeChanged;
		OrderedCollection 		*fDisplayFrames;
		SrceOfLink		 		fSrcLink;
		DestOfLink				fDstLink;
		ODPlatformMenu			fTextMenu;
		ODPlatformMenu			fFontMenu;
		ODMenuBar				fMenuBar;
		ODUShort				fUndoCount;
		ODUShort				fRedoCount;
		ODUShort				fxScaleMultiplier;
		ODUShort				fxScaleDivisor;
		ODUShort				fyScaleMultiplier;
		ODUShort				fyScaleDivisor;
		ODStorageUnit 	 		fTestDragSU;
		ODSemanticInterface 	fSemtIntf;
		LPSTR					fpText;
		LPSTR					fpselStart;
		LPSTR					fpselEnd;
		LPSTR					fpInsert;
		LOGFONT					*fpStyl;
		BOOL					fbReplaceMode;
		int						fDrawMode;	    /* Drawing mode in use */
		LPSTR					fpIdleUpdate;	/* Line to update */
		LPSTR					fpUpdateChar;	/* Char to update */
		int						fcyLineHeight;
		BOOL					fbShowCursor;
		BOOL					fbShowCursorTemp;
		BOOL					fbCanAccept;
		BOOL					fbCanAcceptLink;
		BOOL					fbInDrag;
		ODID					fWindowID;		/* ID of our window */
		int						fcxselStart;
		int						fcxselEnd;
		BOOL					fbFontChanged;
		ODTypeToken				fMenuFocus;
		ODTypeToken				fKeyFocus;
		ODTypeToken				fSelectionFocus;
		ODTypeToken				fClipboardFocus;
		ODPartWrapper			fPartWrapper;
		ODSession				fSession;
		ODBoolean				fIsActive;
		ODBoolean				fNeedsActivating;
		ODFocusSet				fFocusSet;
		ODChangeID				fClipboardChangeID;
		int						fCursorWidth;
		int						fxSaved;
		ODBoolean				fLinksReConnected;
		ODBoolean				fSelectingText;
	};
	#endif // __SOMIDL__
};	//# Interface DragPart


#endif	// _DRAGPART_
