diff --git a/Beutl.slnx b/Beutl.slnx index 7bf6d0fbc..31c8227d1 100644 --- a/Beutl.slnx +++ b/Beutl.slnx @@ -30,7 +30,6 @@ - diff --git a/Directory.Packages.props b/Directory.Packages.props index 5fb8b89ec..03068b574 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,13 +4,13 @@ - - - - - - - + + + + + + + @@ -22,10 +22,10 @@ - - - - + + + + @@ -34,14 +34,14 @@ - - + + - - + + @@ -66,9 +66,9 @@ - - - + + + @@ -77,9 +77,9 @@ - - - + + + @@ -89,4 +89,4 @@ - + \ No newline at end of file diff --git a/src/Beutl.Controls/BcTabItem/BcTabItem.cs b/src/Beutl.Controls/BcTabItem/BcTabItem.cs deleted file mode 100644 index 63ce91374..000000000 --- a/src/Beutl.Controls/BcTabItem/BcTabItem.cs +++ /dev/null @@ -1,110 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Controls.Metadata; -using Avalonia.Controls.Primitives; -using Avalonia.Interactivity; -using Avalonia.Layout; - -using Beutl.Controls.Behaviors; -using Beutl.Controls.Extensions; - -namespace Beutl.Controls; - -[PseudoClasses(":dragging", ":lockdrag")] -public partial class BcTabItem : TabItem -{ - private readonly ItemDragBehavior _dragBehavior; - private Button _closeButton; - - public BcTabItem() - { - Closing += OnClosing; - _dragBehavior = new ItemDragBehavior(); - _dragBehavior.Attach(this); - } - - static BcTabItem() - { - TabStripPlacementProperty.Changed.AddClassHandler((x, _) => x.OnTabStripPlacementChanged()); - CanBeDraggedProperty.Changed.AddClassHandler((x, e) => x.OnCanDraggablePropertyChanged(x, e)); - IsSelectedProperty.Changed.AddClassHandler((x, _) => UpdatePseudoClass(x)); - IsClosableProperty.Changed.Subscribe(e => - { - if (e.Sender is BcTabItem a && a._closeButton != null) - { - a._closeButton.IsVisible = a.IsClosable; - } - }); - } - - private void OnTabStripPlacementChanged() - { - _dragBehavior.Orientation = TabStripPlacement is Dock.Top or Dock.Bottom - ? Orientation.Horizontal - : Orientation.Vertical; - } - - private static void UpdatePseudoClass(BcTabItem item) - { - if (!item.IsSelected) - { - item.PseudoClasses.Remove(":dragging"); - } - } - - internal bool CloseCore() - { - if (Parent is TabControl x) - { - try - { - x.CloseTab(this); - return true; - } - catch - { - return false; - } - } - return false; - } - - public bool Close() - { - RaiseEvent(new RoutedEventArgs(ClosingEvent)); - return CloseCore(); - } - - protected void OnCanDraggablePropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e) - { - if (CanBeDragged) - { - PseudoClasses.Add(":lockdrag"); - } - else - { - PseudoClasses.Remove(":lockdrag"); - } - } - - protected override void OnApplyTemplate(TemplateAppliedEventArgs e) - { - base.OnApplyTemplate(e); - - _closeButton = e.NameScope.Find