Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only use Reactive attribute on the base class #381

Merged
merged 4 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Dock.Model.Avalonia/Core/DockWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Dock.Model.Avalonia.Core;
/// Dock window.
/// </summary>
[DataContract(IsReference = true)]
public class DockWindow : StyledElement, IDockWindow
public class DockWindow : ReactiveBase, IDockWindow
{
/// <summary>
/// Defines the <see cref="Id"/> property.
Expand Down
2 changes: 1 addition & 1 deletion src/Dock.Model.Avalonia/Core/DockableBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Dock.Model.Avalonia.Core;
[JsonDerivedType(typeof(Tool), typeDiscriminator: "Tool")]
[JsonDerivedType(typeof(ToolDock), typeDiscriminator: "ToolDock")]
[JsonDerivedType(typeof(DockBase), typeDiscriminator: "DockBase")]
public abstract class DockableBase : StyledElement, IDockable
public abstract class DockableBase : ReactiveBase, IDockable
{
/// <summary>
/// Defines the <see cref="Id"/> property.
Expand Down
8 changes: 8 additions & 0 deletions src/Dock.Model.Avalonia/Core/ReactiveBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Avalonia;

namespace Dock.Model.Avalonia.Core;

/// <summary>
/// Reactive base class.
/// </summary>
public abstract class ReactiveBase : StyledElement;
3 changes: 1 addition & 2 deletions src/Dock.Model.Mvvm/Core/DockWindow.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Runtime.Serialization;
using CommunityToolkit.Mvvm.ComponentModel;
using Dock.Model.Adapters;
using Dock.Model.Controls;
using Dock.Model.Core;
Expand All @@ -10,7 +9,7 @@ namespace Dock.Model.Mvvm.Core;
/// Dock window.
/// </summary>
[DataContract(IsReference = true)]
public class DockWindow : ObservableObject, IDockWindow
public class DockWindow : ReactiveBase, IDockWindow
{
private readonly IHostAdapter _hostAdapter;
private string _id;
Expand Down
3 changes: 1 addition & 2 deletions src/Dock.Model.Mvvm/Core/DockableBase.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Runtime.Serialization;
using CommunityToolkit.Mvvm.ComponentModel;
using Dock.Model.Adapters;
using Dock.Model.Core;

Expand All @@ -9,7 +8,7 @@ namespace Dock.Model.Mvvm.Core;
/// Dockable base class.
/// </summary>
[DataContract(IsReference = true)]
public abstract class DockableBase : ObservableObject, IDockable
public abstract class DockableBase : ReactiveBase, IDockable
{
private readonly TrackingAdapter _trackingAdapter;
private string _id = string.Empty;
Expand Down
8 changes: 8 additions & 0 deletions src/Dock.Model.Mvvm/Core/ReactiveBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using CommunityToolkit.Mvvm.ComponentModel;

namespace Dock.Model.Mvvm.Core;

/// <summary>
/// Reactive base class.
/// </summary>
public abstract class ReactiveBase : ObservableObject;
1 change: 0 additions & 1 deletion src/Dock.Model.ReactiveUI/Controls/DockDock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ public DockDock()

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial bool LastChildFill { get; set; }
}
1 change: 0 additions & 1 deletion src/Dock.Model.ReactiveUI/Controls/DocumentDock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public partial class DocumentDock : DockBase, IDocumentDock
{
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial bool CanCreateDocument { get; set; }

/// <inheritdoc/>
Expand Down
1 change: 0 additions & 1 deletion src/Dock.Model.ReactiveUI/Controls/ProportionalDock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ public partial class ProportionalDock : DockBase, IProportionalDock
{
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial Orientation Orientation { get; set; }
}
9 changes: 0 additions & 9 deletions src/Dock.Model.ReactiveUI/Controls/RootDock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,47 +26,38 @@ public RootDock()

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial bool IsFocusableRoot { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial IList<IDockable>? HiddenDockables { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial IList<IDockable>? LeftPinnedDockables { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial IList<IDockable>? RightPinnedDockables { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial IList<IDockable>? TopPinnedDockables { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial IList<IDockable>? BottomPinnedDockables { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial IToolDock? PinnedDock { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial IDockWindow? Window { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial IList<IDockWindow>? Windows { get; set; }

/// <inheritdoc/>
Expand Down
4 changes: 0 additions & 4 deletions src/Dock.Model.ReactiveUI/Controls/ToolDock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,17 @@ public ToolDock()

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial Alignment Alignment { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial bool IsExpanded { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial bool AutoHide { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial GripMode GripMode { get; set; }
}
7 changes: 0 additions & 7 deletions src/Dock.Model.ReactiveUI/Core/DockBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,37 +45,30 @@ protected DockBase()

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial IList<IDockable>? VisibleDockables { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial IDockable? ActiveDockable { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial IDockable? DefaultDockable { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial IDockable? FocusedDockable { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial DockMode Dock { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial bool IsActive { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial int OpenedDockablesCount { get; set; }

/// <inheritdoc/>
Expand Down
14 changes: 1 addition & 13 deletions src/Dock.Model.ReactiveUI/Core/DockWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
using Dock.Model.Adapters;
using Dock.Model.Controls;
using Dock.Model.Core;
using ReactiveUI;

namespace Dock.Model.ReactiveUI.Core;

/// <summary>
/// Dock window.
/// </summary>
[DataContract(IsReference = true)]
public partial class DockWindow : ReactiveObject, IDockWindow
public partial class DockWindow : ReactiveBase, IDockWindow
{
private readonly IHostAdapter _hostAdapter;

Expand All @@ -26,57 +25,46 @@ public DockWindow()

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial string Id { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = true, EmitDefaultValue = true)]
[Reactive]
public partial double X { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = true, EmitDefaultValue = true)]
[Reactive]
public partial double Y { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = true, EmitDefaultValue = true)]
[Reactive]
public partial double Width { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = true, EmitDefaultValue = true)]
[Reactive]
public partial double Height { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial bool Topmost { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial string Title { get; set; }

/// <inheritdoc/>
[IgnoreDataMember]
[Reactive]
public partial IDockable? Owner { get; set; }

/// <inheritdoc/>
[IgnoreDataMember]
[Reactive]
public partial IFactory? Factory { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial IRootDock? Layout { get; set; }

/// <inheritdoc/>
[IgnoreDataMember]
[Reactive]
public partial IHostWindow? Host { get; set; }

/// <inheritdoc/>
Expand Down
15 changes: 1 addition & 14 deletions src/Dock.Model.ReactiveUI/Core/DockableBase.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
using System.Runtime.Serialization;
using Dock.Model.Adapters;
using Dock.Model.Core;
using ReactiveUI;

namespace Dock.Model.ReactiveUI.Core;

/// <summary>
/// Dockable base class.
/// </summary>
[DataContract(IsReference = true)]
public abstract partial class DockableBase : ReactiveObject, IDockable
public abstract partial class DockableBase : ReactiveBase, IDockable
{
private readonly TrackingAdapter _trackingAdapter;

Expand All @@ -30,62 +29,50 @@ protected DockableBase()

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial string Id { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial string Title { get; set; }

/// <inheritdoc/>
[IgnoreDataMember]
[Reactive]
public partial object? Context { get; set; }

/// <inheritdoc/>
[IgnoreDataMember]
[Reactive]
public partial IDockable? Owner { get; set; }

/// <inheritdoc/>
[IgnoreDataMember]
[Reactive]
public partial IDockable? OriginalOwner { get; set; }

/// <inheritdoc/>
[IgnoreDataMember]
[Reactive]
public partial IFactory? Factory { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial bool IsEmpty { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial bool IsCollapsable { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial double Proportion { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial bool CanClose { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial bool CanPin { get; set; }

/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
[Reactive]
public partial bool CanFloat { get; set; }

/// <inheritdoc/>
Expand Down
9 changes: 9 additions & 0 deletions src/Dock.Model.ReactiveUI/Core/ReactiveBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using ReactiveUI;

namespace Dock.Model.ReactiveUI.Core;

/// <summary>
/// Reactive base class.
/// </summary>
[Reactive]
public abstract class ReactiveBase : ReactiveObject;
2 changes: 1 addition & 1 deletion src/Dock.Model.ReactiveUI/Dock.Model.ReactiveUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="ReactiveGenerator" Version="0.9.6">
<PackageReference Include="ReactiveGenerator" Version="0.9.13">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Loading