Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.WinFormsUI/2.3.1/WinFormsUI-2.3.1/Docking/DockPanel.DockDragHandler.cs @ 4068

Last change on this file since 4068 was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

File size: 24.6 KB
Line 
1using System.ComponentModel;
2using System.Drawing;
3using System.Drawing.Drawing2D;
4using System.Windows.Forms;
5
6namespace WeifenLuo.WinFormsUI.Docking {
7  partial class DockPanel {
8    private sealed class DockDragHandler : DragHandler {
9      private class DockIndicator : DragForm {
10        #region IHitTest
11        private interface IHitTest {
12          DockStyle HitTest(Point pt);
13          DockStyle Status { get; set; }
14        }
15        #endregion
16
17        #region PanelIndicator
18        private class PanelIndicator : PictureBox, IHitTest {
19          private static Image _imagePanelLeft = Resources.DockIndicator_PanelLeft;
20          private static Image _imagePanelRight = Resources.DockIndicator_PanelRight;
21          private static Image _imagePanelTop = Resources.DockIndicator_PanelTop;
22          private static Image _imagePanelBottom = Resources.DockIndicator_PanelBottom;
23          private static Image _imagePanelFill = Resources.DockIndicator_PanelFill;
24          private static Image _imagePanelLeftActive = Resources.DockIndicator_PanelLeft_Active;
25          private static Image _imagePanelRightActive = Resources.DockIndicator_PanelRight_Active;
26          private static Image _imagePanelTopActive = Resources.DockIndicator_PanelTop_Active;
27          private static Image _imagePanelBottomActive = Resources.DockIndicator_PanelBottom_Active;
28          private static Image _imagePanelFillActive = Resources.DockIndicator_PanelFill_Active;
29
30          public PanelIndicator(DockStyle dockStyle) {
31            m_dockStyle = dockStyle;
32            SizeMode = PictureBoxSizeMode.AutoSize;
33            Image = ImageInactive;
34          }
35
36          private DockStyle m_dockStyle;
37          private DockStyle DockStyle {
38            get { return m_dockStyle; }
39          }
40
41          private DockStyle m_status;
42          public DockStyle Status {
43            get { return m_status; }
44            set {
45              if (value != DockStyle && value != DockStyle.None)
46                throw new InvalidEnumArgumentException();
47
48              if (m_status == value)
49                return;
50
51              m_status = value;
52              IsActivated = (m_status != DockStyle.None);
53            }
54          }
55
56          private Image ImageInactive {
57            get {
58              if (DockStyle == DockStyle.Left)
59                return _imagePanelLeft;
60              else if (DockStyle == DockStyle.Right)
61                return _imagePanelRight;
62              else if (DockStyle == DockStyle.Top)
63                return _imagePanelTop;
64              else if (DockStyle == DockStyle.Bottom)
65                return _imagePanelBottom;
66              else if (DockStyle == DockStyle.Fill)
67                return _imagePanelFill;
68              else
69                return null;
70            }
71          }
72
73          private Image ImageActive {
74            get {
75              if (DockStyle == DockStyle.Left)
76                return _imagePanelLeftActive;
77              else if (DockStyle == DockStyle.Right)
78                return _imagePanelRightActive;
79              else if (DockStyle == DockStyle.Top)
80                return _imagePanelTopActive;
81              else if (DockStyle == DockStyle.Bottom)
82                return _imagePanelBottomActive;
83              else if (DockStyle == DockStyle.Fill)
84                return _imagePanelFillActive;
85              else
86                return null;
87            }
88          }
89
90          private bool m_isActivated = false;
91          private bool IsActivated {
92            get { return m_isActivated; }
93            set {
94              m_isActivated = value;
95              Image = IsActivated ? ImageActive : ImageInactive;
96            }
97          }
98
99          public DockStyle HitTest(Point pt) {
100            return this.Visible && ClientRectangle.Contains(PointToClient(pt)) ? DockStyle : DockStyle.None;
101          }
102        }
103        #endregion PanelIndicator
104
105        #region PaneIndicator
106        private class PaneIndicator : PictureBox, IHitTest {
107          private struct HotSpotIndex {
108            public HotSpotIndex(int x, int y, DockStyle dockStyle) {
109              m_x = x;
110              m_y = y;
111              m_dockStyle = dockStyle;
112            }
113
114            private int m_x;
115            public int X {
116              get { return m_x; }
117            }
118
119            private int m_y;
120            public int Y {
121              get { return m_y; }
122            }
123
124            private DockStyle m_dockStyle;
125            public DockStyle DockStyle {
126              get { return m_dockStyle; }
127            }
128          }
129
130          private static Bitmap _bitmapPaneDiamond = Resources.DockIndicator_PaneDiamond;
131          private static Bitmap _bitmapPaneDiamondLeft = Resources.DockIndicator_PaneDiamond_Left;
132          private static Bitmap _bitmapPaneDiamondRight = Resources.DockIndicator_PaneDiamond_Right;
133          private static Bitmap _bitmapPaneDiamondTop = Resources.DockIndicator_PaneDiamond_Top;
134          private static Bitmap _bitmapPaneDiamondBottom = Resources.DockIndicator_PaneDiamond_Bottom;
135          private static Bitmap _bitmapPaneDiamondFill = Resources.DockIndicator_PaneDiamond_Fill;
136          private static Bitmap _bitmapPaneDiamondHotSpot = Resources.DockIndicator_PaneDiamond_HotSpot;
137          private static Bitmap _bitmapPaneDiamondHotSpotIndex = Resources.DockIndicator_PaneDiamond_HotSpotIndex;
138          private static HotSpotIndex[] _hotSpots = new HotSpotIndex[]
139      {
140        new HotSpotIndex(1, 0, DockStyle.Top),
141        new HotSpotIndex(0, 1, DockStyle.Left),
142        new HotSpotIndex(1, 1, DockStyle.Fill),
143        new HotSpotIndex(2, 1, DockStyle.Right),
144        new HotSpotIndex(1, 2, DockStyle.Bottom)
145      };
146          private static GraphicsPath _displayingGraphicsPath = DrawHelper.CalculateGraphicsPathFromBitmap(_bitmapPaneDiamond);
147
148          public PaneIndicator() {
149            SizeMode = PictureBoxSizeMode.AutoSize;
150            Image = _bitmapPaneDiamond;
151            Region = new Region(DisplayingGraphicsPath);
152          }
153
154          public static GraphicsPath DisplayingGraphicsPath {
155            get { return _displayingGraphicsPath; }
156          }
157
158          public DockStyle HitTest(Point pt) {
159            if (!Visible)
160              return DockStyle.None;
161
162            pt = PointToClient(pt);
163            if (!ClientRectangle.Contains(pt))
164              return DockStyle.None;
165
166            for (int i = _hotSpots.GetLowerBound(0); i <= _hotSpots.GetUpperBound(0); i++) {
167              if (_bitmapPaneDiamondHotSpot.GetPixel(pt.X, pt.Y) == _bitmapPaneDiamondHotSpotIndex.GetPixel(_hotSpots[i].X, _hotSpots[i].Y))
168                return _hotSpots[i].DockStyle;
169            }
170
171            return DockStyle.None;
172          }
173
174          private DockStyle m_status = DockStyle.None;
175          public DockStyle Status {
176            get { return m_status; }
177            set {
178              m_status = value;
179              if (m_status == DockStyle.None)
180                Image = _bitmapPaneDiamond;
181              else if (m_status == DockStyle.Left)
182                Image = _bitmapPaneDiamondLeft;
183              else if (m_status == DockStyle.Right)
184                Image = _bitmapPaneDiamondRight;
185              else if (m_status == DockStyle.Top)
186                Image = _bitmapPaneDiamondTop;
187              else if (m_status == DockStyle.Bottom)
188                Image = _bitmapPaneDiamondBottom;
189              else if (m_status == DockStyle.Fill)
190                Image = _bitmapPaneDiamondFill;
191            }
192          }
193        }
194        #endregion PaneIndicator
195
196        #region consts
197        private int _PanelIndicatorMargin = 10;
198        #endregion
199
200        private DockDragHandler m_dragHandler;
201
202        public DockIndicator(DockDragHandler dragHandler) {
203          m_dragHandler = dragHandler;
204          Controls.AddRange(new Control[] {
205                  PaneDiamond,
206                  PanelLeft,
207                  PanelRight,
208                  PanelTop,
209                  PanelBottom,
210                  PanelFill
211                  });
212          Region = new Region(Rectangle.Empty);
213        }
214
215        private PaneIndicator m_paneDiamond = null;
216        private PaneIndicator PaneDiamond {
217          get {
218            if (m_paneDiamond == null)
219              m_paneDiamond = new PaneIndicator();
220
221            return m_paneDiamond;
222          }
223        }
224
225        private PanelIndicator m_panelLeft = null;
226        private PanelIndicator PanelLeft {
227          get {
228            if (m_panelLeft == null)
229              m_panelLeft = new PanelIndicator(DockStyle.Left);
230
231            return m_panelLeft;
232          }
233        }
234
235        private PanelIndicator m_panelRight = null;
236        private PanelIndicator PanelRight {
237          get {
238            if (m_panelRight == null)
239              m_panelRight = new PanelIndicator(DockStyle.Right);
240
241            return m_panelRight;
242          }
243        }
244
245        private PanelIndicator m_panelTop = null;
246        private PanelIndicator PanelTop {
247          get {
248            if (m_panelTop == null)
249              m_panelTop = new PanelIndicator(DockStyle.Top);
250
251            return m_panelTop;
252          }
253        }
254
255        private PanelIndicator m_panelBottom = null;
256        private PanelIndicator PanelBottom {
257          get {
258            if (m_panelBottom == null)
259              m_panelBottom = new PanelIndicator(DockStyle.Bottom);
260
261            return m_panelBottom;
262          }
263        }
264
265        private PanelIndicator m_panelFill = null;
266        private PanelIndicator PanelFill {
267          get {
268            if (m_panelFill == null)
269              m_panelFill = new PanelIndicator(DockStyle.Fill);
270
271            return m_panelFill;
272          }
273        }
274
275        private bool m_fullPanelEdge = false;
276        public bool FullPanelEdge {
277          get { return m_fullPanelEdge; }
278          set {
279            if (m_fullPanelEdge == value)
280              return;
281
282            m_fullPanelEdge = value;
283            RefreshChanges();
284          }
285        }
286
287        public DockDragHandler DragHandler {
288          get { return m_dragHandler; }
289        }
290
291        public DockPanel DockPanel {
292          get { return DragHandler.DockPanel; }
293        }
294
295        private DockPane m_dockPane = null;
296        public DockPane DockPane {
297          get { return m_dockPane; }
298          internal set {
299            if (m_dockPane == value)
300              return;
301
302            DockPane oldDisplayingPane = DisplayingPane;
303            m_dockPane = value;
304            if (oldDisplayingPane != DisplayingPane)
305              RefreshChanges();
306          }
307        }
308
309        private IHitTest m_hitTest = null;
310        private IHitTest HitTestResult {
311          get { return m_hitTest; }
312          set {
313            if (m_hitTest == value)
314              return;
315
316            if (m_hitTest != null)
317              m_hitTest.Status = DockStyle.None;
318
319            m_hitTest = value;
320          }
321        }
322
323        private DockPane DisplayingPane {
324          get { return ShouldPaneDiamondVisible() ? DockPane : null; }
325        }
326
327        private void RefreshChanges() {
328          Region region = new Region(Rectangle.Empty);
329          Rectangle rectDockArea = FullPanelEdge ? DockPanel.DockArea : DockPanel.DocumentWindowBounds;
330
331          rectDockArea = RectangleToClient(DockPanel.RectangleToScreen(rectDockArea));
332          if (ShouldPanelIndicatorVisible(DockState.DockLeft)) {
333            PanelLeft.Location = new Point(rectDockArea.X + _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2);
334            PanelLeft.Visible = true;
335            region.Union(PanelLeft.Bounds);
336          } else
337            PanelLeft.Visible = false;
338
339          if (ShouldPanelIndicatorVisible(DockState.DockRight)) {
340            PanelRight.Location = new Point(rectDockArea.X + rectDockArea.Width - PanelRight.Width - _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2);
341            PanelRight.Visible = true;
342            region.Union(PanelRight.Bounds);
343          } else
344            PanelRight.Visible = false;
345
346          if (ShouldPanelIndicatorVisible(DockState.DockTop)) {
347            PanelTop.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelTop.Width) / 2, rectDockArea.Y + _PanelIndicatorMargin);
348            PanelTop.Visible = true;
349            region.Union(PanelTop.Bounds);
350          } else
351            PanelTop.Visible = false;
352
353          if (ShouldPanelIndicatorVisible(DockState.DockBottom)) {
354            PanelBottom.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelBottom.Width) / 2, rectDockArea.Y + rectDockArea.Height - PanelBottom.Height - _PanelIndicatorMargin);
355            PanelBottom.Visible = true;
356            region.Union(PanelBottom.Bounds);
357          } else
358            PanelBottom.Visible = false;
359
360          if (ShouldPanelIndicatorVisible(DockState.Document)) {
361            Rectangle rectDocumentWindow = RectangleToClient(DockPanel.RectangleToScreen(DockPanel.DocumentWindowBounds));
362            PanelFill.Location = new Point(rectDocumentWindow.X + (rectDocumentWindow.Width - PanelFill.Width) / 2, rectDocumentWindow.Y + (rectDocumentWindow.Height - PanelFill.Height) / 2);
363            PanelFill.Visible = true;
364            region.Union(PanelFill.Bounds);
365          } else
366            PanelFill.Visible = false;
367
368          if (ShouldPaneDiamondVisible()) {
369            Rectangle rect = RectangleToClient(DockPane.RectangleToScreen(DockPane.ClientRectangle));
370            PaneDiamond.Location = new Point(rect.Left + (rect.Width - PaneDiamond.Width) / 2, rect.Top + (rect.Height - PaneDiamond.Height) / 2);
371            PaneDiamond.Visible = true;
372            using (GraphicsPath graphicsPath = PaneIndicator.DisplayingGraphicsPath.Clone() as GraphicsPath) {
373              Point[] pts = new Point[]
374            {
375              new Point(PaneDiamond.Left, PaneDiamond.Top),
376              new Point(PaneDiamond.Right, PaneDiamond.Top),
377              new Point(PaneDiamond.Left, PaneDiamond.Bottom)
378            };
379              using (Matrix matrix = new Matrix(PaneDiamond.ClientRectangle, pts)) {
380                graphicsPath.Transform(matrix);
381              }
382              region.Union(graphicsPath);
383            }
384          } else
385            PaneDiamond.Visible = false;
386
387          Region = region;
388        }
389
390        private bool ShouldPanelIndicatorVisible(DockState dockState) {
391          if (!Visible)
392            return false;
393
394          if (DockPanel.DockWindows[dockState].Visible)
395            return false;
396
397          return DragHandler.DragSource.IsDockStateValid(dockState);
398        }
399
400        private bool ShouldPaneDiamondVisible() {
401          if (DockPane == null)
402            return false;
403
404          if (!DockPanel.AllowEndUserNestedDocking)
405            return false;
406
407          return DragHandler.DragSource.CanDockTo(DockPane);
408        }
409
410        public override void Show(bool bActivate) {
411          base.Show(bActivate);
412          Bounds = SystemInformation.VirtualScreen;
413          RefreshChanges();
414        }
415
416        public void TestDrop() {
417          Point pt = Control.MousePosition;
418          DockPane = DockHelper.PaneAtPoint(pt, DockPanel);
419
420          if (TestDrop(PanelLeft, pt) != DockStyle.None)
421            HitTestResult = PanelLeft;
422          else if (TestDrop(PanelRight, pt) != DockStyle.None)
423            HitTestResult = PanelRight;
424          else if (TestDrop(PanelTop, pt) != DockStyle.None)
425            HitTestResult = PanelTop;
426          else if (TestDrop(PanelBottom, pt) != DockStyle.None)
427            HitTestResult = PanelBottom;
428          else if (TestDrop(PanelFill, pt) != DockStyle.None)
429            HitTestResult = PanelFill;
430          else if (TestDrop(PaneDiamond, pt) != DockStyle.None)
431            HitTestResult = PaneDiamond;
432          else
433            HitTestResult = null;
434
435          if (HitTestResult != null) {
436            if (HitTestResult is PaneIndicator)
437              DragHandler.Outline.Show(DockPane, HitTestResult.Status);
438            else
439              DragHandler.Outline.Show(DockPanel, HitTestResult.Status, FullPanelEdge);
440          }
441        }
442
443        private static DockStyle TestDrop(IHitTest hitTest, Point pt) {
444          return hitTest.Status = hitTest.HitTest(pt);
445        }
446      }
447
448      private class DockOutline : DockOutlineBase {
449        public DockOutline() {
450          m_dragForm = new DragForm();
451          SetDragForm(Rectangle.Empty);
452          DragForm.BackColor = SystemColors.ActiveCaption;
453          DragForm.Opacity = 0.5;
454          DragForm.Show(false);
455        }
456
457        DragForm m_dragForm;
458        private DragForm DragForm {
459          get { return m_dragForm; }
460        }
461
462        protected override void OnShow() {
463          CalculateRegion();
464        }
465
466        protected override void OnClose() {
467          DragForm.Close();
468        }
469
470        private void CalculateRegion() {
471          if (SameAsOldValue)
472            return;
473
474          if (!FloatWindowBounds.IsEmpty)
475            SetOutline(FloatWindowBounds);
476          else if (DockTo is DockPanel)
477            SetOutline(DockTo as DockPanel, Dock, (ContentIndex != 0));
478          else if (DockTo is DockPane)
479            SetOutline(DockTo as DockPane, Dock, ContentIndex);
480          else
481            SetOutline();
482        }
483
484        private void SetOutline() {
485          SetDragForm(Rectangle.Empty);
486        }
487
488        private void SetOutline(Rectangle floatWindowBounds) {
489          SetDragForm(floatWindowBounds);
490        }
491
492        private void SetOutline(DockPanel dockPanel, DockStyle dock, bool fullPanelEdge) {
493          Rectangle rect = fullPanelEdge ? dockPanel.DockArea : dockPanel.DocumentWindowBounds;
494          rect.Location = dockPanel.PointToScreen(rect.Location);
495          if (dock == DockStyle.Top) {
496            int height = dockPanel.GetDockWindowSize(DockState.DockTop);
497            rect = new Rectangle(rect.X, rect.Y, rect.Width, height);
498          } else if (dock == DockStyle.Bottom) {
499            int height = dockPanel.GetDockWindowSize(DockState.DockBottom);
500            rect = new Rectangle(rect.X, rect.Bottom - height, rect.Width, height);
501          } else if (dock == DockStyle.Left) {
502            int width = dockPanel.GetDockWindowSize(DockState.DockLeft);
503            rect = new Rectangle(rect.X, rect.Y, width, rect.Height);
504          } else if (dock == DockStyle.Right) {
505            int width = dockPanel.GetDockWindowSize(DockState.DockRight);
506            rect = new Rectangle(rect.Right - width, rect.Y, width, rect.Height);
507          } else if (dock == DockStyle.Fill) {
508            rect = dockPanel.DocumentWindowBounds;
509            rect.Location = dockPanel.PointToScreen(rect.Location);
510          }
511
512          SetDragForm(rect);
513        }
514
515        private void SetOutline(DockPane pane, DockStyle dock, int contentIndex) {
516          if (dock != DockStyle.Fill) {
517            Rectangle rect = pane.DisplayingRectangle;
518            if (dock == DockStyle.Right)
519              rect.X += rect.Width / 2;
520            if (dock == DockStyle.Bottom)
521              rect.Y += rect.Height / 2;
522            if (dock == DockStyle.Left || dock == DockStyle.Right)
523              rect.Width -= rect.Width / 2;
524            if (dock == DockStyle.Top || dock == DockStyle.Bottom)
525              rect.Height -= rect.Height / 2;
526            rect.Location = pane.PointToScreen(rect.Location);
527
528            SetDragForm(rect);
529          } else if (contentIndex == -1) {
530            Rectangle rect = pane.DisplayingRectangle;
531            rect.Location = pane.PointToScreen(rect.Location);
532            SetDragForm(rect);
533          } else {
534            using (GraphicsPath path = pane.TabStripControl.GetOutline(contentIndex)) {
535              RectangleF rectF = path.GetBounds();
536              Rectangle rect = new Rectangle((int)rectF.X, (int)rectF.Y, (int)rectF.Width, (int)rectF.Height);
537              using (Matrix matrix = new Matrix(rect, new Point[] { new Point(0, 0), new Point(rect.Width, 0), new Point(0, rect.Height) })) {
538                path.Transform(matrix);
539              }
540              Region region = new Region(path);
541              SetDragForm(rect, region);
542            }
543          }
544        }
545
546        private void SetDragForm(Rectangle rect) {
547          DragForm.Bounds = rect;
548          if (rect == Rectangle.Empty)
549            DragForm.Region = new Region(Rectangle.Empty);
550          else if (DragForm.Region != null)
551            DragForm.Region = null;
552        }
553
554        private void SetDragForm(Rectangle rect, Region region) {
555          DragForm.Bounds = rect;
556          DragForm.Region = region;
557        }
558      }
559
560      public DockDragHandler(DockPanel panel)
561        : base(panel) {
562      }
563
564      public new IDockDragSource DragSource {
565        get { return base.DragSource as IDockDragSource; }
566        set { base.DragSource = value; }
567      }
568
569      private DockOutlineBase m_outline;
570      public DockOutlineBase Outline {
571        get { return m_outline; }
572        private set { m_outline = value; }
573      }
574
575      private DockIndicator m_indicator;
576      private DockIndicator Indicator {
577        get { return m_indicator; }
578        set { m_indicator = value; }
579      }
580
581      private Rectangle m_floatOutlineBounds;
582      private Rectangle FloatOutlineBounds {
583        get { return m_floatOutlineBounds; }
584        set { m_floatOutlineBounds = value; }
585      }
586
587      public void BeginDrag(IDockDragSource dragSource) {
588        DragSource = dragSource;
589
590        if (!BeginDrag()) {
591          DragSource = null;
592          return;
593        }
594
595        Outline = new DockOutline();
596        Indicator = new DockIndicator(this);
597        Indicator.Show(false);
598
599        FloatOutlineBounds = DragSource.BeginDrag(StartMousePosition);
600      }
601
602      protected override void OnDragging() {
603        TestDrop();
604      }
605
606      protected override void OnEndDrag(bool abort) {
607        DockPanel.SuspendLayout(true);
608
609        Outline.Close();
610        Indicator.Close();
611
612        EndDrag(abort);
613
614        // Queue a request to layout all children controls
615        DockPanel.PerformMdiClientLayout();
616
617        DockPanel.ResumeLayout(true, true);
618
619        DragSource = null;
620      }
621
622      private void TestDrop() {
623        Outline.FlagTestDrop = false;
624
625        Indicator.FullPanelEdge = ((Control.ModifierKeys & Keys.Shift) != 0);
626
627        if ((Control.ModifierKeys & Keys.Control) == 0) {
628          Indicator.TestDrop();
629
630          if (!Outline.FlagTestDrop) {
631            DockPane pane = DockHelper.PaneAtPoint(Control.MousePosition, DockPanel);
632            if (pane != null && DragSource.IsDockStateValid(pane.DockState))
633              pane.TestDrop(DragSource, Outline);
634          }
635
636          if (!Outline.FlagTestDrop && DragSource.IsDockStateValid(DockState.Float)) {
637            FloatWindow floatWindow = DockHelper.FloatWindowAtPoint(Control.MousePosition, DockPanel);
638            if (floatWindow != null)
639              floatWindow.TestDrop(DragSource, Outline);
640          }
641        } else
642          Indicator.DockPane = DockHelper.PaneAtPoint(Control.MousePosition, DockPanel);
643
644        if (!Outline.FlagTestDrop) {
645          if (DragSource.IsDockStateValid(DockState.Float)) {
646            Rectangle rect = FloatOutlineBounds;
647            rect.Offset(Control.MousePosition.X - StartMousePosition.X, Control.MousePosition.Y - StartMousePosition.Y);
648            Outline.Show(rect);
649          }
650        }
651
652        if (!Outline.FlagTestDrop) {
653          Cursor.Current = Cursors.No;
654          Outline.Show();
655        } else
656          Cursor.Current = DragControl.Cursor;
657      }
658
659      private void EndDrag(bool abort) {
660        if (abort)
661          return;
662
663        if (!Outline.FloatWindowBounds.IsEmpty)
664          DragSource.FloatAt(Outline.FloatWindowBounds);
665        else if (Outline.DockTo is DockPane) {
666          DockPane pane = Outline.DockTo as DockPane;
667          DragSource.DockTo(pane, Outline.Dock, Outline.ContentIndex);
668        } else if (Outline.DockTo is DockPanel) {
669          DockPanel panel = Outline.DockTo as DockPanel;
670          panel.UpdateDockWindowZOrder(Outline.Dock, Outline.FlagFullEdge);
671          DragSource.DockTo(panel, Outline.Dock);
672        }
673      }
674    }
675
676    private DockDragHandler m_dockDragHandler = null;
677    private DockDragHandler GetDockDragHandler() {
678      if (m_dockDragHandler == null)
679        m_dockDragHandler = new DockDragHandler(this);
680      return m_dockDragHandler;
681    }
682
683    internal void BeginDrag(IDockDragSource dragSource) {
684      GetDockDragHandler().BeginDrag(dragSource);
685    }
686  }
687}
Note: See TracBrowser for help on using the repository browser.