Skip to content

Commit 274b03e

Browse files
Merge tag '5.4.1' into develop
2 parents a6b83cf + 32bef86 commit 274b03e

File tree

2 files changed

+0
-120
lines changed

2 files changed

+0
-120
lines changed

src/Orc.Controls.Tests/PublicApiFacts.Orc_Controls_HasNoBreakingChanges_Async.verified.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2223,7 +2223,6 @@ namespace Orc.Controls
22232223
public TearOffWindow(Orc.Controls.TearOffTabItem originalTabItem, object? content, string title) { }
22242224
public bool AllowDockBack { get; set; }
22252225
public bool IsClosing { get; }
2226-
public object? OriginalContent { get; }
22272226
public bool WasDockedBack { get; set; }
22282227
public void DockBack() { }
22292228
public object? GetDetachedContent() { }

src/Orc.Controls/Controls/TabControl/TearOff/TearOffWindow.cs

Lines changed: 0 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,8 @@
66
using System.Windows.Controls;
77
using System.Windows.Data;
88
using System.Windows.Forms;
9-
using System.Windows.Input;
10-
using System.Windows.Media;
119
using Catel.IoC;
1210
using Catel.Services;
13-
using Application = System.Windows.Application;
14-
using Cursors = System.Windows.Input.Cursors;
15-
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
1611

1712
/// <summary>
1813
/// Window that hosts a torn-off tab content
@@ -37,7 +32,6 @@ public TearOffWindow(TearOffTabItem originalTabItem, object? content, string tit
3732
_originalContent = content;
3833

3934
InitializeWindow(content, title);
40-
SetupDragAndDrop();
4135

4236
Loaded += OnLoaded;
4337
Unloaded += OnUnloaded;
@@ -52,11 +46,6 @@ public bool AllowDockBack
5246
set => SetValue(AllowDockBackProperty, value);
5347
}
5448

55-
/// <summary>
56-
/// Gets the original content that was in the tab
57-
/// </summary>
58-
public object? OriginalContent => _originalContent;
59-
6049
/// <summary>
6150
/// Gets whether this window was closed due to docking back
6251
/// </summary>
@@ -235,114 +224,6 @@ private void AddDockBackButton(object? originalContent)
235224
SetCurrentValue(ContentProperty, _windowContentGrid);
236225
}
237226

238-
private void SetupDragAndDrop()
239-
{
240-
MouseLeftButtonDown += OnMouseLeftButtonDown;
241-
MouseMove += OnMouseMove;
242-
MouseLeftButtonUp += OnMouseLeftButtonUp;
243-
}
244-
245-
private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
246-
{
247-
if (AllowDockBack && e.ClickCount == 1)
248-
{
249-
DragMove();
250-
}
251-
else if (e.ClickCount == 2)
252-
{
253-
// Double-click to dock back
254-
DockBack();
255-
}
256-
}
257-
258-
private void OnMouseMove(object sender, MouseEventArgs e)
259-
{
260-
if (AllowDockBack && e.LeftButton == MouseButtonState.Pressed && !_isDockingBack)
261-
{
262-
// Check if we're over a valid drop target (TabControl)
263-
CheckForDockTarget();
264-
}
265-
}
266-
267-
private void OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
268-
{
269-
if (_isDockingBack)
270-
{
271-
return;
272-
}
273-
274-
if (AllowDockBack)
275-
{
276-
// Check if we should dock back
277-
var dropTarget = GetDropTarget();
278-
if (dropTarget is not null)
279-
{
280-
DockBack();
281-
}
282-
}
283-
}
284-
285-
private void CheckForDockTarget()
286-
{
287-
var dropTarget = GetDropTarget();
288-
// Visual feedback could be added here
289-
SetCurrentValue(CursorProperty, dropTarget is not null ? Cursors.Hand : Cursors.Arrow);
290-
}
291-
292-
private TabControl? GetDropTarget()
293-
{
294-
var mousePos = GetMousePosition();
295-
var elementUnderMouse = GetElementUnderMouse(mousePos);
296-
297-
// Walk up the visual tree to find a TabControl
298-
var current = elementUnderMouse;
299-
while (current is not null)
300-
{
301-
if (current is TabControl tabControl)
302-
{
303-
return tabControl;
304-
}
305-
306-
current = VisualTreeHelper.GetParent(current);
307-
}
308-
309-
return null;
310-
}
311-
312-
private DependencyObject? GetElementUnderMouse(Point screenPoint)
313-
{
314-
// Convert screen coordinates to find element
315-
foreach (Window window in Application.Current.Windows)
316-
{
317-
if (window == this)
318-
{
319-
continue;
320-
}
321-
322-
try
323-
{
324-
var windowPoint = window.PointFromScreen(screenPoint);
325-
if (windowPoint is { X: >= 0, Y: >= 0 } &&
326-
windowPoint.X <= window.ActualWidth && windowPoint.Y <= window.ActualHeight)
327-
{
328-
return window.InputHitTest(windowPoint) as DependencyObject;
329-
}
330-
}
331-
catch
332-
{
333-
// Ignore hit test failures
334-
}
335-
}
336-
337-
return null;
338-
}
339-
340-
private Point GetMousePosition()
341-
{
342-
var point = Mouse.GetPosition(Application.Current.MainWindow);
343-
return Application.Current.MainWindow?.PointToScreen(point) ?? new Point(0, 0);
344-
}
345-
346227
private void EnsureWindowOnScreen()
347228
{
348229
var screen = Screen.FromPoint(

0 commit comments

Comments
 (0)