forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add basic support for ContentSite and ContentSiteView
- Loading branch information
1 parent
e356253
commit 05dffe7
Showing
6 changed files
with
99 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
|
||
namespace Microsoft.UI.Content; | ||
|
||
/// <summary> | ||
/// Provides a host environment for a ContentIsland. | ||
/// </summary> | ||
public partial class ContentSite | ||
#if HAS_UNO_WINUI // These interfaces are not currently implemented and the Generated partial does not exist in UWP build. | ||
: IDisposable, IClosableNotifier | ||
#endif | ||
{ | ||
internal ContentSite() => View = new(this); | ||
|
||
/// <summary> | ||
/// Gets or sets whether this ContentSite is visible. | ||
/// </summary> | ||
public bool IsSiteVisible { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the parent default scaling factor for this ContentSite. | ||
/// </summary> | ||
public float ParentScale { get; set; } = 1f; | ||
|
||
/// <summary> | ||
/// Gets or sets the scaling factor to use for this ContentSite, which overrides the ParentScale. | ||
/// </summary> | ||
public float OverrideScale { get; set; } = 1f; | ||
|
||
/// <summary> | ||
/// Gets the computed local DPI for this ContentSite. | ||
/// </summary> | ||
public float RasterizationScale => OverrideScale * ParentScale; | ||
|
||
/// <summary> | ||
/// Gets the ContentSiteView associated with this ContentSite. | ||
/// </summary> | ||
public ContentSiteView View { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
|
||
namespace Microsoft.UI.Content; | ||
|
||
/// <summary> | ||
/// Provides access to a read-only view of ContentSite properties. | ||
/// </summary> | ||
/// <remarks> | ||
/// This object exposes the most recent values from a ContentSite, | ||
/// it is not a snapshot in time. | ||
/// </remarks> | ||
public partial class ContentSiteView | ||
{ | ||
private readonly ContentSite _contentSite; | ||
|
||
internal ContentSiteView(ContentSite contentSite) | ||
{ | ||
_contentSite = contentSite ?? throw new ArgumentNullException(nameof(contentSite)); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the IsSiteVisible state reported by the ContentSite. | ||
/// </summary> | ||
public bool IsSiteVisible => _contentSite.IsSiteVisible; | ||
|
||
/// <summary> | ||
/// Gets the default scaling factor of the parent for a single ContentSite. | ||
/// </summary> | ||
public float ParentScale => _contentSite.ParentScale; | ||
|
||
/// <summary> | ||
/// Gets the override scaling factor for a single ContentSite, ignoring the default scaling factor of the parent. | ||
/// </summary> | ||
public float OverrideScale => _contentSite.OverrideScale; | ||
|
||
/// <summary> | ||
/// Gets the computed local DPI for the associated ContentSite, | ||
/// which is computed from the OverrideScale and ParentScale. | ||
/// </summary> | ||
public float RasterizationScale => _contentSite.RasterizationScale; | ||
} |
6 changes: 0 additions & 6 deletions
6
src/Uno.UI/UI/Xaml/Internal/ContentManager/IContentHost.skia.cs
This file was deleted.
Oops, something went wrong.