diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-20 14:17:56 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-20 14:22:24 +0100 |
| commit | 520c769424c42841cd123e46a07b728b9f243a64 (patch) | |
| tree | eb2016499e4da7b4f085888aee4e61655ce957db /src/GraphicObjects/DockWindow.cs | |
| parent | 85c564717f2d9ab75288b2a680cdb3f58a1b0e86 (diff) | |
debug threading with new TemplatedGroup arch, review examples.
Diffstat (limited to 'src/GraphicObjects/DockWindow.cs')
| -rw-r--r-- | src/GraphicObjects/DockWindow.cs | 133 |
1 files changed, 84 insertions, 49 deletions
diff --git a/src/GraphicObjects/DockWindow.cs b/src/GraphicObjects/DockWindow.cs index 5e066f39..b68a3085 100644 --- a/src/GraphicObjects/DockWindow.cs +++ b/src/GraphicObjects/DockWindow.cs @@ -52,63 +52,98 @@ namespace Crow NotifyValueChanged ("IsDocked", isDocked); } } - public override void OnLayoutChanges (LayoutingType layoutType) - { - base.OnLayoutChanges (layoutType); - - if (isDocked) - return; - - Docker dv = Parent as Docker; - if (dv == null) - return; - - Rectangle dvCliRect = dv.ClientRectangle; - - if (layoutType == LayoutingType.X) { - if (Slot.X < dv.DockingThreshold) - dock (Alignment.Left); - else if (Slot.Right > dvCliRect.Width - dv.DockingThreshold) - dock (Alignment.Right); - }else if (layoutType == LayoutingType.Y) { - if (Slot.Y < dv.DockingThreshold) - dock (Alignment.Top); - else if (Slot.Bottom > dvCliRect.Height - dv.DockingThreshold) - dock (Alignment.Bottom); + public Alignment DockingPosition { + get { return docking; } + set { + if (docking == value) + return; + docking = value; + NotifyValueChanged ("DockingPosition", DockingPosition); } } - - public override void onMouseMove (object sender, MouseMoveEventArgs e) + protected override void onDrop (object sender, DragDropEventArgs e) { - lastMousePos = e.Position; + base.onDrop (sender, e); + Docker dv = Parent as Docker; + dv.Dock (this); + } + public override bool PointIsIn (ref Point m) + { + if (!base.PointIsIn(ref m)) + return false; - if (this.HasFocus && e.Mouse.IsButtonDown (MouseButton.Left) && IsDocked) { - Docker dv = Parent as Docker; - if (docking == Alignment.Left) { - if (lastMousePos.X - undockingMousePosOrig.X > dv.DockingThreshold) - undock (); - } else if (docking == Alignment.Right) { - if (undockingMousePosOrig.X - lastMousePos.X > dv.DockingThreshold) - undock (); - } else if (docking == Alignment.Top) { - if (lastMousePos.Y - undockingMousePosOrig.Y > dv.DockingThreshold) - undock (); - } else if (docking == Alignment.Bottom) { - if (undockingMousePosOrig.Y - lastMousePos.Y > dv.DockingThreshold) - undock (); + Group p = Parent as Group; + if (p != null) { + lock (p.Children) { + for (int i = p.Children.Count - 1; i >= 0; i--) { + if (p.Children [i] == this) + break; + if (p.Children [i].Slot.ContainsOrIsEqual (m)) { + return false; + } + } } - return; } - - base.onMouseMove (sender, e); + return Slot.ContainsOrIsEqual(m); } - public override void onMouseDown (object sender, MouseButtonEventArgs e) - { - base.onMouseDown (sender, e); - if (this.HasFocus && IsDocked && e.Button == MouseButton.Left) - undockingMousePosOrig = lastMousePos; - } +// public override void OnLayoutChanges (LayoutingType layoutType) +// { +// base.OnLayoutChanges (layoutType); +// +// if (isDocked) +// return; + +// Docker dv = Parent as Docker; +// if (dv == null) +// return; +// +// Rectangle dvCliRect = dv.ClientRectangle; +// +// if (layoutType == LayoutingType.X) { +// if (Slot.X < dv.DockingThreshold) +// dock (Alignment.Left); +// else if (Slot.Right > dvCliRect.Width - dv.DockingThreshold) +// dock (Alignment.Right); +// }else if (layoutType == LayoutingType.Y) { +// if (Slot.Y < dv.DockingThreshold) +// dock (Alignment.Top); +// else if (Slot.Bottom > dvCliRect.Height - dv.DockingThreshold) +// dock (Alignment.Bottom); +// } +// } +// +// public override void onMouseMove (object sender, MouseMoveEventArgs e) +// { +// lastMousePos = e.Position; +// +// if (this.HasFocus && e.Mouse.IsButtonDown (MouseButton.Left) && IsDocked) { +// Docker dv = Parent as Docker; +// if (docking == Alignment.Left) { +// if (lastMousePos.X - undockingMousePosOrig.X > dv.DockingThreshold) +// undock (); +// } else if (docking == Alignment.Right) { +// if (undockingMousePosOrig.X - lastMousePos.X > dv.DockingThreshold) +// undock (); +// } else if (docking == Alignment.Top) { +// if (lastMousePos.Y - undockingMousePosOrig.Y > dv.DockingThreshold) +// undock (); +// } else if (docking == Alignment.Bottom) { +// if (undockingMousePosOrig.Y - lastMousePos.Y > dv.DockingThreshold) +// undock (); +// } +// return; +// } +// +// base.onMouseMove (sender, e); +// } +// public override void onMouseDown (object sender, MouseButtonEventArgs e) +// { +// base.onMouseDown (sender, e); +// +// if (this.HasFocus && IsDocked && e.Button == MouseButton.Left) +// undockingMousePosOrig = lastMousePos; +// } // protected override void onBorderMouseEnter (object sender, MouseMoveEventArgs e) // { |