home *** CD-ROM | disk | FTP | other *** search
- /*
- File: CAProxyPartDnD.cpp
-
- Contains: ODPart methods to support drag & drop
-
- Written by: PartMaker
-
- Change History (most recent first):
-
- <2> 11/18/95 RB Major strip down, Removed many obsolete methods
- <1> 6/15-6/30 RB Major rewrite.
-
- ------------------------------------------------------------------------------
-
- <16> 5/19/95 SJF Fix bug that includes a NOPart on a native
- content drag (not a final bug fix)
- <15> 5/18/95 RB Fixing a couple final geometry bugs
- <14> 5/18/95 SJF Fixes to local source drag handling
- <10> 5/16/95 SJF Change Drop to utilize new UTIL_Container... frame
- negotiation callbacks
- <8> 5/09/95 SJF Drag hilite changes.
- <6> 5/08/95 SJF Cleanup Drag & Drop - What happend in revision 5????
- <2> 4/30/95 SJF Add changes from b1c19 TestDraw part...
- <1> 3/15/95 SJF first checked in
- <0> 3/6/95 SJF Moved methods from CAProxyPartStubs.cpp
-
- To Do:
- */
-
-
-
- #ifndef _EXCEPT_
- #include <Except.h>
- #endif
-
- #ifndef _CAPROXYPART_
- #include "CAProxyPart.h"
- #endif
-
- #ifndef _CAPROXYPARTDEF_
- #include "CAProxyPartDef.h"
- #endif
-
- #ifndef SOM_ODWindow_xh
- #include <Window.xh>
- #endif
-
- #include <PlfmDef.h>
-
- #ifndef __DRAG__
- #include <Drag.h>
- #endif
-
- #ifndef SOM_ODDragAndDrop_xh
- #include <DragDrp.xh>
- #endif
-
- #ifndef SOM_ODDragItemIterator_xh
- #include <DgItmIt.xh>
- #endif
-
- #ifndef SOM_ODFrameFacetIterator_xh
- #include <FrFaItr.xh>
- #endif
-
- #ifndef SOM_ODStorageUnit_xh
- #include <StorageU.xh>
- #endif
-
- #ifndef _ORDCOLL_
- #include <OrdColl.h>
- #endif
-
- #ifndef SOM_ODDraft_xh
- #include <Draft.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdTypes_defined
- #include <StdTypes.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdProps_defined
- #include <StdProps.xh>
- #endif
-
- #ifndef SOM_ODStorageUnitView_xh
- #include <SUView.xh>
- #endif
-
- #ifndef SOM_ODFacet_xh
- #include <Facet.xh>
- #endif
-
- #ifndef SOM_ODShape_xh
- #include <Shape.xh>
- #endif
-
- #ifndef _STORUTIL_
- #include <StorUtil.h>
- #endif
-
- #ifndef _ODUTILS_
- #include <ODUtils.h>
- #endif
-
- #ifndef _ISOSTR_
- #include <ISOStr.h>
- #endif
-
- #ifndef _BARRAY_
- #include <BArray.h>
- #endif
-
- #ifndef _FOCUSLIB_
- #include <FocusLib.h>
- #endif
-
- #ifndef _ODUTILS_
- #include <ODUtils.h>
- #endif
-
- #ifdef applec
- #pragma segment CAProxyPart
- #endif
-
-
- //====================================================================
- // CAProxyPart
- //
- // DragAndDrop protocol
- //====================================================================
-
-
- void CAProxyPart::DropCompleted(Environment* ev, ODPart* destPart, ODDropResult dropResult)
- {
- ODUnused(ev);
- ODUnused(destPart);
- ODUnused(dropResult);
- }
-
-
-
- ODDragResult CAProxyPart::DragEnter(Environment* ev, ODDragItemIterator* dragInfo,
- ODFacet* facet, ODPoint* where)
- {
- ODUnused (dragInfo);
- ODUnused (where);
-
- ODStorageUnit* dragSU = kODNULL;
- ODDragResult canHandleDrop = kODTrue;
- ODWindow* aWindow;
- ODPlatformWindow platformWindow;
- DragReference macDrag;
- ODSession* session = fSelf->GetStorageUnit(ev)->GetSession(ev);
-
- // Check to see if the CA can handle the drop...
- if (fCADnDTrackHnd)
- {
-
- short message;
-
- aWindow = facet->GetFrame(ev)->AcquireWindow(ev);
- platformWindow = aWindow->GetPlatformWindow(ev);
- aWindow->Release(ev);
-
- macDrag = session->GetDragAndDrop(ev)->GetDragReference(ev);
-
- message = dragTrackingEnterHandler;
-
- CallDragTrackingHandlerProc( fCADnDTrackHnd, message, platformWindow, fTrackRefCon, macDrag );
-
- message = dragTrackingEnterWindow;
-
- CallDragTrackingHandlerProc( fCADnDTrackHnd, message, platformWindow, fTrackRefCon, macDrag );
-
- }
-
- return canHandleDrop;
- }
-
-
-
- ODDragResult CAProxyPart::DragWithin(Environment* ev, ODDragItemIterator* dragInfo,
- ODFacet* facet, ODPoint* where)
-
- // Tracks the drag operation, and provides graphical feedback
- // regarding possible drop targets.
- //
- // This method highlights the appropriate content to provide
- // feedback about potential drop targets, based on type of dragged
- // data. It gets the type information out of the dragInfo. During
- // drag tracking (DragEnter, DragWithin) the part should never
- // attempt to read data from any of the storage units supplied by
- // the iterator. The part should only inspect the type of the
- // dragged data. Before calling tis method, you must ensure that
- // the part was previously activated via DragEnter().
- //
- // DragWithin() is called continuously when the mouse is still in
- // the facet. This allows the part to do any processing desired.
- // One good example is when the frame has several hot spots where
- // objects can be dropped. If the mouse is not over these hot spots,
- // the cursor may need to be changed to reflect that the no
- // dropping can be done there even though it is still in a
- // droppable frame. Again, a ODDragItemIterator is passed in so
- // that the part can examine the availabe data types of the dragged
- // objects.
- //
- // DragWithin() also provides a chance for the part to examine the
- // state of the machine. For example, some part may want to find
- // out whether the modifier keys are down or not.
-
- {
- ODUnused (dragInfo);
- ODUnused (where);
-
- ODStorageUnit* dragSU = kODNULL;
- ODDragResult canHandleDrop = kODTrue;
- ODWindow* aWindow;
- ODPlatformWindow platformWindow;
- DragReference macDrag;
- ODSession* session = fSelf->GetStorageUnit(ev)->GetSession(ev);
-
- // Check to see if the CA needs notification
-
- if (fCADnDTrackHnd)
- {
- short message;
-
- message = dragTrackingInWindow;
-
- aWindow = facet->GetFrame(ev)->AcquireWindow(ev);
- platformWindow = aWindow->GetPlatformWindow(ev);
- aWindow->Release(ev);
-
- macDrag = session->GetDragAndDrop(ev)->GetDragReference(ev);
- CallDragTrackingHandlerProc( fCADnDTrackHnd, message, platformWindow, fTrackRefCon, macDrag );
- }
-
- return canHandleDrop;
- }
-
-
-
- void CAProxyPart::DragLeave(Environment* ev, ODFacet* facet, ODPoint* where)
- {
- ODUnused (where);
-
- ODWindow* aWindow;
- ODPlatformWindow platformWindow;
- DragReference macDrag;
- ODSession* session = fSelf->GetStorageUnit(ev)->GetSession(ev);
-
- // Check to see if the CA needs notification
- if (fCADnDTrackHnd)
- {
- short message;
-
- message = dragTrackingLeaveWindow;
-
- aWindow = facet->GetFrame(ev)->AcquireWindow(ev);
- platformWindow = aWindow->GetPlatformWindow(ev);
- aWindow->Release(ev);
-
- macDrag = session->GetDragAndDrop(ev)->GetDragReference(ev);
- CallDragTrackingHandlerProc( fCADnDTrackHnd, message, platformWindow, fTrackRefCon, macDrag );
- }
-
- }
-
-
- //-------------------------------------------------------------------------
- // CAProxyPart::Drop
- //-------------------------------------------------------------------------
-
- ODDropResult CAProxyPart::Drop(Environment *ev,
- ODDragItemIterator* dropInfo,
- ODFacet* facet,
- ODPoint* where)
- {
- ODStorageUnit* dragSU = kODNULL;
- ODDragResult canHandleDrop = kODTrue;
- ODDropResult dropResult = kODDropFail;
- ODWindow* aWindow;
- ODPlatformWindow platformWindow;
- DragReference macDrag;
- OSErr err;
- ODULong dragAttributes;
- ODSession* session = fSelf->GetStorageUnit(ev)->GetSession(ev);
-
- dragAttributes = session->GetDragAndDrop(ev)->GetDragAttributes(ev);
-
- if (dragAttributes & kODDropIsMove)
- {
-
- dropResult = kODDropMove;
-
- if (dragAttributes & kODDropIsInSourcePart)
- {
- dropResult = kODDropCopy;
- }
-
- }
- else if (dragAttributes & kODDropIsCopy)
- {
- dropResult = kODDropCopy;
- }
-
- // Check to see if the CA needs notification
- if (fCADnDReceiveHnd)
- {
- aWindow = facet->GetFrame(ev)->AcquireWindow(ev);
- platformWindow = aWindow->GetPlatformWindow(ev);
- aWindow->Release(ev);
-
- macDrag = session->GetDragAndDrop(ev)->GetDragReference(ev);
-
- err = (OSErr) CallDragReceiveHandlerProc(fCADnDReceiveHnd, platformWindow, fReceiveRefCon, macDrag);
-
- }
-
- if (err != noErr)
- dropResult = kODDropFail;
-
- return (dropResult);
-
- }
-
- //-------------------------------------------------------------------------
- // CAProxyPart::FulfillPromise
- //-------------------------------------------------------------------------
-
- void CAProxyPart::FulfillPromise(Environment *ev,
- ODStorageUnitView* promiseSUView)
- {
- ODUnused (ev);
- ODUnused (promiseSUView);
- }
-
-
-
-