InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IDragDropController.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Dave Burnard
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //
23 // Interface definition for the Drag and Drop controller
24 //
25 //========================================================================================
26 
27 #ifndef __IDragDropController__
28 #define __IDragDropController__
29 
30 #include "CDataExchangeController.h"
31 
32 #include "DragDropConstants.h"
33 
34 #include "IPMDataObject.h"
35 #include "IDataExchangeHandler.h"
36 #include "PMPoint.h"
37 #include "DragDropID.h"
38 #include "CursorSpec.h"
39 
40 class IPMDataObject;
41 class IDragDropSource;
42 class IDragDropTarget;
43 class IEvent;
44 class DataObjectIterator;
45 class IAbortableCmdSeq;
46 
56 {
57  public:
58  enum { kDefaultIID = IID_IDRAGDROPCONTROLLER };
59 
60  public:
61  // ----- Constructor/Destructor
63  virtual ~IDragDropController() {};
64 
65  // ----- Managing the drag UI
76  virtual bool16 StartDrag(IDragDropSource*, IEvent* e, bool16 patientUser = kFalse) = 0;
77 
81  virtual ErrorCode ClearDrag() = 0;
82 
90  virtual bool16 IsDragInProgress() const = 0;
91 
99  virtual GSysPoint GetDragMouseLocation() const = 0;
100 
106  virtual bool16 IsPatientUser() const = 0;
107 
112  virtual bool16 IsUserUsingCopyGesture() const = 0;
113 
119  virtual bool16 DidUserUseCopyGesture() const = 0;
120 
126  virtual bool16 DidUserUseDragChildrenGesture() const = 0;
127 
133  virtual bool16 IsTargetSameAsSource() const = 0;
134 
143  virtual bool16 NeedsToInternalize() const = 0;
144 
145  // ----- Methods to access data contained in a drag.
156  virtual uint16 GetItemCount() = 0;
157 
167  virtual IPMDataObject* AddDragItem(uint32 itemID) = 0; // Returns an addref'd interface, caller must release
168 
175  virtual IPMDataObject* GetDragItem(uint32 itemID) = 0;
176 
183  virtual IAbortableCmdSeq* GetCommandSequence() const = 0;
184 
185  // ----- Active handlers
193  virtual IDataExchangeHandler* QuerySourceHandler() const = 0;
194 
201  virtual void SetSourceHandler(IDataExchangeHandler* handler) = 0;
202 
209  virtual IDataExchangeHandler* QueryTargetHandler() const = 0;
210 
219  virtual void SetTargetHandler(IDataExchangeHandler* handler) = 0;
220 
231  virtual IDataExchangeHandler* QueryHandlerForInternalize(DataExchangeResponse& response, const PMFlavor& internalizedFlavor = kNoFlavor) const = 0;
232 
233  // ----- Externalize/Internalize Methods
243  virtual ErrorCode FulfillPromise(IPMDataObject* whichItem, const ExternalPMFlavor& whichFlavor) const = 0;
244 
250  virtual ErrorCode ExternalizeDrag(PMFlavor whichFlavor) const = 0;
251 
259  virtual bool16 CanInternalizeDuringTracking() const = 0;
260 
269  virtual ErrorCode InternalizeDrag(ExternalPMFlavor extFlavor, PMFlavor intFlavor) = 0;
270 
271  // ----- Support for target supplied cursor feedback
278  virtual void SetTrackingCursorFeedback(const CursorSpec& cursor) = 0;
279 
287 
293  virtual bool16 WillTargetProvideCursorFeedback() const = 0;
294 
295  // ----- Support for platform specific drag drop features
296 #ifdef MACINTOSH
297 
303  virtual OSErr CopyDropLocation(CFURLRef* dropLocation) const = 0;
304 
311  virtual OSErr SetDropLocation(CFURLRef dropLocation) = 0;
312 #endif
313 
322  virtual void SuppressExternalDragHandling(bool16 doSuppress) = 0;
323 };
324 
334 {
335  public:
337  {
338  InterfacePtr<IDragDropController> dragController(GetExecutionContextSession(), IID_IDRAGDROPCONTROLLER);
339  if (dragController)
340  dragController->SuppressExternalDragHandling(kTrue);
341  }
342 
344  {
345  InterfacePtr<IDragDropController> dragController(GetExecutionContextSession(), IID_IDRAGDROPCONTROLLER);
346  if (dragController)
347  dragController->SuppressExternalDragHandling(kFalse);
348  }
349 };
350 
351 #endif