home *** CD-ROM | disk | FTP | other *** search
- /*
- File: CALib.h
-
- Contains: Container Application Library header (public)
-
- Written by: Tantek Çelik, Jens Alfke, Joshua Susser, Steve Foley, Rick Badertscher
-
- Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <16> 5/12/95 RB Removing CAOffsetFrame()
- <15> 4/23/95 RB Added GetFocusOwner() routine.
- Added CAFrameRefValid(), CAFrameRefCopy(), CAFrameRefEqual()
-
- <14> 4/19/95 RB Layout API Renovation
- <13> 4/7/95 SJF Changes to the DnD API
- <12> 4/7/95 SJF final cleanup
- <11> 4/05/95 SJF Strip out definition of data types to CA_Defs.h
- <10> 4/02/95 RB Integrating changes for b1c14 build
- <9> 4/01/95 RB Added CAActivateWindowHandler callback to
- allow CA to respond when the ODWindowState
- activates/deactivates windows.
- <8> 3/27/95 RB Modified CALib type definitions to
- more readable form.
- <7> 3/16/95 RB Added some comments on the CADoc API
- <6> 3/15/95 SJF Modify Drag & Drop API
- <4+> 2/28/95 SJF merge in changes from RickB
- <4> 2/13/95 SJF Interim checkin to update project database
- <3> 12/19/94 SJF Clean up API to meet actual CA needs
- <2> 10/30/94 SV SOMverted
- <1> 4/20/94 jpa Added error reporting calls.
- <0> 4/19/94 JA Got it to compile!
- <-1> 3/25/94 JBS layout, menu & UI fixes
- <-2> 3/21/94 TÇ use pascal calling conventions, reconcile
- CALength into CASize, length as out
- parameter in CASaveDocument
- <-3> 3/18/94 JBS imaging changes, remove XMP-types, install
- callbacks
- <-4> 3/17/94 T first checked in
- To Do:
- - Implement
- */
-
- #ifndef _CALIB_
- #define _CALIB_
-
- #ifndef __DRAG__
- #include <Drag.h> // For DragTrackingHandler type, etc.
- #endif
-
- #ifndef __EDITIONS__
- #include <Editions.h> // For SectionHandle type, etc.
- #endif
-
- #ifndef _CADEFS_
- #include "CADefs.h"
- #endif
-
-
-
- //=========================================================================
- // CALib Public API
- //=========================================================================
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
-
- //=========================================================================
- // Error reporting
- //=========================================================================
-
- pascal OSErr CAError( void );
-
- pascal CAErrorProc CASetErrorProc( CAErrorProc proc );
-
- //=========================================================================
- // Session
- //=========================================================================
-
- pascal void CAInit( void );
- pascal void CAShutdown( void );
-
- //=========================================================================
- // Document API
- //=========================================================================
- //
- // A CA can opt to use one of 2 storage models for CADocuments,
- //
- // Using the Native storage model, CALib writes the ODContainer containing
- // the Proxy part storage into the data fork of the document file. To save
- // a document, the CA provides a file and an offset to write the ODContainer.
- //
- // Using the OpenDoc model, the Application document stream as well as the
- // proxy part ODContainer are stored in a single OpenDoc container file.
- // The CAStream API allows the App to read/write to the embedded document
- // stream.
- //
- //-------------------------------------------------------------------------
-
- //-------------------------------------------------------------------------
- // CACreateDocument() : Returns a reference to an empty document. The
- // document may be used as either OpenDoc or Native, the type is
- // bound at CASaveDocument() time.
- //
- // For each CADocument, CALib maintains a temporary container. The temp container
- // may be file or memory based, specified by containerType.
- //-------------------------------------------------------------------------
- pascal CADocumentRef CACreateDocument( FSSpecPtr docSpec,
- Handle docHandle);
-
- //-------------------------------------------------------------------------
- // CAOpenDocument() : Use offset & length to specify the size and location
- // of an embedded OpenDoc Container, for Native storage model.
- // For the OpenDoc storage model set offset & length to 0, this indicates
- // that the file specified by docSpec is a single OpenDoc container.
- //
- // A CA may open a CADocument from docHandle. The CADocument must have
- // been previously saved to memory via CASaveDocument. offset & length
- // specify the container length and location within docHandle.
- //
- // For each CADocument, CALib maintains a temporary container. The temp container
- // may be file or memory based, specified by containerType.
- //-------------------------------------------------------------------------
-
- pascal CADocumentRef CAOpenDocument( FSSpecPtr docSpec,
- Handle docHandle,
- CAOffset offset,
- CASize length);
-
- //-------------------------------------------------------------------------
- // CASaveDocument() : For the Native storage model use offset to
- // specify where to write the ODContainer in your file.
- // For the OpenDoc storage model CASaveDocument writes out the entire
- // ODContainer as the file, including the document stream.
- //
- // A CA may alternatively pass a non-NULL handle in docHandle
- // to save the document to memory. docHandle must be a non-NULL
- // handle and is realloced internally. If offset is non-zero, CASaveDocument
- // will preserve the original contents of docHandle's memory.
- //-------------------------------------------------------------------------
-
- pascal void CASaveDocument( CADocumentRef document,
- FSSpecPtr newFile,
- Handle* docHandle,
- CAOffset offset,
- CASize* length);
-
- pascal void CACloseDocument( CADocumentRef );
-
- pascal Boolean CAHasDocumentChanged( CADocumentRef );
-
- pascal void CASetDocumentKind( CADocumentRef document, CAISOStr kind );
-
- // CAGetDocumentKind() - The CA should dispose of the result with DisposePtr()
-
- pascal CAISOStr CAGetDocumentKind( CADocumentRef document);
-
-
- // Multiple Document Kind Support
-
- // CAUseKind() - if kind is NULL then index is used. if there is no such kind
- // (the ISOStr passed in doesn't exist, or the index is out of range) then
- // FALSE is returned, else TRUE is returned
-
- pascal Boolean CAUseKind( CADocumentRef document, CAISOStr kind, short index);
- pascal CAISOStr CACurrentKind( CADocumentRef document);
- pascal void CAAddKind( CADocumentRef document, CAISOStr kind);
- pascal void CARemoveKind( CADocumentRef document, CAISOStr kind);
- pascal CAISOStr CAGetNthKind( CADocumentRef document, short index);
- pascal short CAGetKindCount( CADocumentRef document);
-
-
- //=========================================================================
- // Stream
- //=========================================================================
- // The Stream API is used by a CA implementing the OpenDoc storage model.
- //-------------------------------------------------------------------------
-
-
- pascal void CARead( CADocumentRef, char* buffer, CASize* length );
- pascal void CAWrite( CADocumentRef, char* buffer, CASize* length );
- pascal CASize CAGetSize( CADocumentRef);
- pascal CASize CAGetOffset( CADocumentRef);
- pascal void CASetOffset( CADocumentRef, CASize offset );
- pascal void CAInsert( CADocumentRef, char* buffer, CASize* length );
- pascal void CADelete( CADocumentRef, char* buffer, CASize* length );
-
-
- //=========================================================================
- // Data Interchange
- //=========================================================================
-
- pascal CACloneKey CABeginClone( CADocumentRef sourceDocument,
- CADocumentRef destDocument,
- CACloneKind cloneKind );
-
- pascal void CAEndClone( CADocumentRef sourceDocument,
- CADocumentRef destDocument,
- CACloneKey clonekey );
-
- pascal CAFrameRef CACloneFrameRef( CAFrameRef sourceFrameRef,
- // can be NULL if only one frame in source document
- CADocumentRef sourceDocument,
- CADocumentRef destDocument,
- Boolean isRootFrameRef,
- CACloneKey cloneKey);
-
- // when copying a bunch of data from one document to another,
- // BeginClone, then Clone the FrameRefs, the stream out native content using
- // the newly returned FrameRefs, then EndClone
- // if none of the Cloned FrameRefs had isRootFrameRef set to true, then EndClone
- // sets the native content as the root.
-
- //=========================================================================
- // Clipboard
- //=========================================================================
-
- pascal CADocumentRef CAGetClipboardDocument( void );
- pascal void CAExportClipboard( void);
-
- // to paste from the clipboard,
- // CloneFrameRef(clipbdFrameRef,clipbdDocument,destDocument)
- // clipbdFrameRef is cloned from the clipboard to destDocument, and its
- // CAFrameRef within the context of destDocument is returned
-
- // to copy to the clipboard,
- // CloneFrameRef(sourceFrameRef,sourceDocument,clipbdDocument)
- // sourceFrameRef is cloned from sourceDocument to the clipboard, and its
- // CAFrameRef within the context of the clipboard is returned
-
- // Use Stream API to write native contents to the ClipDocument
-
- //=========================================================================
- // Drag and Drop
- //=========================================================================
-
- pascal CADocumentRef CAGetDragDropDocument( ItemReference item );
-
- pascal CADropResult CAStartDrag( CADocumentRef document,
- EventRecord* event,
- RgnHandle dragRgn);
-
- pascal void CASetDataSendProc( CADocumentRef document,
- DragSendDataUPP sendProc,
- void* refCon);
-
- // for backward compatibilty with Apps which already support Drag Manager
-
- pascal OSErr CAInstallTrackingHandler( DragTrackingHandler trackingHandler,
- WindowPtr window,
- void* handlerRefCon );
-
- pascal OSErr CAInstallReceiveHandler( DragReceiveHandler receiveHandler,
- WindowPtr window,
- void* handlerRefCon );
-
- pascal OSErr CARemoveTrackingHandler( DragTrackingHandler trackingHandler,
- WindowPtr theWindow);
-
- pascal OSErr CARemoveReceiveHandler( DragReceiveHandler receiveHandler,
- WindowPtr theWindow);
-
- //=========================================================================
- // Window Management
- //=========================================================================
-
- pascal Boolean CAIsPartWindow( WindowPtr );
-
- pascal WindowPtr CAGetFrontDocWindow( void );
- pascal WindowPtr CAGetFrontFloatingWindow( void );
- pascal void CASelectWindow( WindowPtr );
-
- pascal void CARegisterRootWindow( WindowPtr,
- CADocumentRef);
-
- pascal void CARegisterFloatingWindow( WindowPtr);
-
-
- pascal void CAUnregisterWindow( WindowPtr );
-
- //=========================================================================
- // Window Management Callbacks (Optional)
- //=========================================================================
-
-
- // CAWindowActivateHandler - Called when a window is activated, deactivated
- // by the ODWindowState. OD does not generate activate events.
- pascal OSErr CAInstallWindowActivateHandler (CAWindowActivateHandler,
- CADocumentRef);
-
-
- pascal OSErr CAInstallFloatingWindowHandlers ( CASelectWindowHandler handler1,
- CAFrontWindowHandler handler2,
- CAIsFloaterHandler handler3);
-
- //=========================================================================
- // Focus Arbitration
- //=========================================================================
-
-
- pascal Boolean CARequestStandardFocusSet( WindowPtr window );
- pascal Boolean CARequestModalFocus( WindowPtr window );
-
- pascal void CARelinquishStandardFocusSet( WindowPtr window );
- pascal void CARelinquishModalFocus( WindowPtr window );
-
- // callbacks
- pascal void CAInstallFocusNotification( CAFocusAcquiredProc focusAquiredProc,
- CAFocusLostProc focusLostProc,
- CADocumentRef document );
-
-
-
- //=========================================================================
- // Layout
- //=========================================================================
- //
- // A frame which is visible has a CAVisFrame associated with it.
- //
-
- // Embedded Frame callbacks
-
- pascal void CAInstallFrameShapeRequestHandler ( CAFrameShapeRequestHandler handler,
- CADocumentRef document);
-
-
- // Frame manipulation
- //
- // The transform associated with a frame represents the scrolled position
- // of it's contents.
- //
- // CASetFrameRgn() & CASetFrameTransform() consume RgnHandle & CATransform
- // respectively
-
- pascal CAFrameRef CAGetRootFrameRef( CADocumentRef document);
-
- pascal void CARemoveFrameRef( CADocumentRef document,
- CAFrameRef frame );
-
- pascal RgnHandle CAGetFrameRgn( CADocumentRef document,
- CAFrameRef frame );
-
- pascal void CASetFrameRgn( CADocumentRef document,
- CAFrameRef frame,
- RgnHandle frameRgn );
-
- pascal RgnHandle CAGetUsedRgn( CADocumentRef document,
- CAFrameRef frame );
-
- pascal void CAGetFrameTransform( CADocumentRef document,
- CAFrameRef frameRef,
- CATransform* transform );
-
- pascal void CASetFrameTransform( CADocumentRef document,
- CAFrameRef frameRef,
- CATransform* transform );
-
- pascal Boolean CAGetFrozen( CADocumentRef document,
- CAFrameRef frame );
-
- pascal void CASetFrozen( CADocumentRef document,
- CAFrameRef frame,
- Boolean isFrozen );
-
- pascal Boolean CAActiveBorderContainsPoint( Point mouse);
-
- // VisFrame manipulation
- // The transform of a CAVisFrame defines the VisFrames position
- // within it's containing frame. Location.
-
-
- pascal CAVisFrame CAGetVisFrame( CADocumentRef document,
- CAFrameRef frame );
-
- pascal CAVisFrame CAMakeVisFrame( CADocumentRef document,
- CAFrameRef frame,
- RgnHandle clipRgn,
- CATransform* xform,
- GrafPtr port );
-
- pascal void CARemoveVisFrame( CAVisFrame visFrame );
-
- pascal void CAAdjustVisFrame( CAVisFrame visFrame,
- RgnHandle clipRgn,
- CATransform* xform );
-
- pascal void CAGetVisFrameTransform( CADocumentRef document,
- CAFrameRef frameRef,
- CATransform* xform );
-
-
- pascal Boolean CAGetSelected( CAVisFrame visFrame );
- pascal void CASetSelected( CAVisFrame visFrame, Boolean isSelected );
-
- pascal CAHighlight CAGetHighlight( CAVisFrame visFrame );
- pascal void CASetHighlight( CAVisFrame visFrame, CAHighlight highlight );
-
-
- // Transform utilities
-
- pascal void CAMoveTransformBy( CATransform* transform, Point offset );
- pascal void CAMoveTransformTo( CATransform* transform, Point origin );
-
- // Other transform utility routines
-
-
- //=========================================================================
- // Imaging
- //=========================================================================
-
- pascal GrafPtr CAGetCanvas( CAVisFrame visFrame, CAGraphicsSystem graphicsSystem );
- pascal void CADrawFrame( CAVisFrame visFrame, RgnHandle invalidRgn );
- pascal void CADrawActiveBorder( void);
-
- // callbacks
- pascal void CAInstallCanvasNotification( CACanvasUpdatedProc proc,
- CADocumentRef document);
-
- pascal void CACanvasUpdated( GrafPtr port );
-
- //-------------------------------------------------------------------------
- // Menu
- //-------------------------------------------------------------------------
-
- pascal void CASetBaseMenuBar( Handle menuBar );
- pascal void CAAdjustMenus( void );
- pascal void CARegisterCommand( CACommandID command,
- CAMenuID menu,
- CAMenuItemID menuItem );
-
- pascal Boolean CADispatchMenuEvent( EventRecord* event, long menuSelection );
-
- //-------------------------------------------------------------------------
- // UI Events
- //-------------------------------------------------------------------------
-
- pascal Boolean CADispatchEvent( EventRecord* event, CAEventInfo* eventInfo );
-
- pascal RgnHandle CAGetMouseRegion( void );
- pascal long CAGetSleepTime( void );
-
- // callbacks
- pascal void CAInstallBorderAdjuster(CADocumentRef,
- CAAdjustBorderProc);
-
- pascal void CAAdjustActiveBorder( CADocumentRef document, CAFrameRef frame, RgnHandle border );
-
-
- //-------------------------------------------------------------------------
- // Undo
- //-------------------------------------------------------------------------
-
- pascal void CAClearUndo( void );
-
- //-------------------------------------------------------------------------
- // Proxy Root Part
- //-------------------------------------------------------------------------
-
- pascal Boolean CAShowPartFrameInfo( CADocumentRef, CAVisFrame visFrame);
-
- pascal void CAViewFrameInWindow (CADocumentRef, CAFrameRef);
-
- // Does this really belong here?
- // I think the Proxy Root Part is invisible to the Container Application.
- // -Tantek
-
-
- #ifdef __cplusplus
- }
- #endif
-
-
-
- #endif // _CALIB_