InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CListBoxDragDropTarget.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 // Implementation of a ListBox Drag and Drop target
24 //
25 //========================================================================================
26 
27 #ifdef ID_DEPRECATED // listboxes will disappear from a future version of InDesign. Please use TreeViews instead.
28 
29 #include "ShuksanID.h"
30 #include "DragDropID.h"
31 
32 #include "IEvent.h"
33 #include "CDragDropTarget.h"
34 #include "IDragDropController.h"
35 #include "PMFlavorTypes.h"
36 #include "DataObjectIterator.h"
37 #include "CmdUtils.h"
38 #include "PMRect.h"
39 
40 #include "DVAForwardDeclarations.h"
41 
42 #ifdef WIDGET_BUILD
43 #endif
44 
45 class CListBoxDragDropTarget : public CDragDropTarget
46 {
47  public:
48  CListBoxDragDropTarget(IPMUnknown *boss);
49  virtual ~CListBoxDragDropTarget();
50 
51  virtual void DoDragEnter();
52  virtual void DoDragWithin(const PMPoint& localPt);
53  virtual void DoDragLeave();
54  // Tracking the drag as it enters, drags, and leaves this target
55 
58  // Can the target accept the data being dragged?
59  // (Drag source is provided to determine if data should be moved, copied or linked.)
60 
61  virtual bool16 HitTest_OutsideBounds(const SysPoint&) const;
62  // Override to allow drop targets to respond outside their actual bounds.
63  // (usually used for autoscrolling a target when over its scroll bars)
64  // default implementation returns kFalse
65 
66  protected:
67  virtual void CalculateCanInsertRange(int32 item);
68  virtual bool16 CanInsertBefore(int32 item) const;
69  virtual bool16 ShouldDrawInsertionGraphic() const;
70  virtual int32 GetDropBeforeItemNumber() const;
71 
72  virtual void DrawInsertionGraphic(const PMRect& itemBounds);
73  virtual void RemoveInsertionGraphic(const PMRect& itemBounds);
74  bool DoDirectDrawingForTargetHilite(const dvaui::ui::UI_Node* nodeP, dvaui::drawbot::Drawbot* drawbotP);
75  bool DirectDrawHilite(const dvaui::ui::UI_Node* nodeP, dvaui::drawbot::Drawbot* drawbotP);
76 
77  bool16 fLocalDrop; // true if target == source
78 
79 
80  private:
81  int32 fStartCanInsertItem;
82  int32 fEndCanInsertItem;
83  bool16 fInsertDrawn; // true if insert graphic is currently visible
84  int32 fItemLocation; // 0 - item in middle; 1 - first item in view; 2 - last item in view
85  int32 fInsertBeforeItem;
86  PMRect fInsertionBounds;
87  SysRect fPreviousHilite;
88  int32 fInsertionPointIndex;
89 };
90 
91 
92 #endif