mirror of
https://github.com/ZuneDev/Xune.git
synced 2026-07-27 13:13:10 -07:00
Added UIX library
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.Alignment
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal enum Alignment
|
||||
{
|
||||
Unspecified,
|
||||
Near,
|
||||
Center,
|
||||
Far,
|
||||
Fill,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.AreaOfInterest
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Render;
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal struct AreaOfInterest
|
||||
{
|
||||
private Rectangle _rectangle;
|
||||
private Rectangle _displayRectangle;
|
||||
private AreaOfInterestID _id;
|
||||
|
||||
public AreaOfInterest(Size size, AreaOfInterestID id)
|
||||
: this(size, Inset.Zero, id)
|
||||
{
|
||||
}
|
||||
|
||||
public AreaOfInterest(Size size, Inset margins, AreaOfInterestID id)
|
||||
: this(new Rectangle(Point.Zero, size), margins, id)
|
||||
{
|
||||
}
|
||||
|
||||
public AreaOfInterest(Rectangle rectangle, AreaOfInterestID id)
|
||||
: this(rectangle, rectangle, id)
|
||||
{
|
||||
}
|
||||
|
||||
public AreaOfInterest(Rectangle rectangle, Inset margins, AreaOfInterestID id)
|
||||
: this(rectangle, Rectangle.Inflate(rectangle, margins.ToRect), id)
|
||||
{
|
||||
}
|
||||
|
||||
public AreaOfInterest(Rectangle rectangle, Rectangle displayRectangle, AreaOfInterestID id)
|
||||
{
|
||||
_rectangle = rectangle;
|
||||
_displayRectangle = displayRectangle;
|
||||
_id = id;
|
||||
}
|
||||
|
||||
public AreaOfInterest Transform(Point offset) => new AreaOfInterest(Rectangle.Offset(_rectangle, offset), Rectangle.Offset(_displayRectangle, offset), Id);
|
||||
|
||||
public static void AddAreaOfInterest(
|
||||
AreaOfInterest interest,
|
||||
ref Vector<AreaOfInterest> areasOfInterestList)
|
||||
{
|
||||
if (areasOfInterestList == null)
|
||||
areasOfInterestList = new Vector<AreaOfInterest>();
|
||||
for (int index = 0; index < areasOfInterestList.Count; ++index)
|
||||
{
|
||||
if (areasOfInterestList[index].Id == interest.Id)
|
||||
return;
|
||||
}
|
||||
areasOfInterestList.Add(interest);
|
||||
}
|
||||
|
||||
public override string ToString() => InvariantString.Format("AreaOfInterest(\"{0}\", {1}, {2})", Id, Rectangle, DisplayRectangle);
|
||||
|
||||
public override int GetHashCode() => _rectangle.GetHashCode() ^ _displayRectangle.GetHashCode() ^ _id.GetHashCode();
|
||||
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
try
|
||||
{
|
||||
return this == (AreaOfInterest)other;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(AreaOfInterest other) => _rectangle == other._rectangle && _displayRectangle == other._displayRectangle && _id == other._id;
|
||||
|
||||
public static bool operator ==(AreaOfInterest a, AreaOfInterest b) => a._rectangle == b._rectangle && a._displayRectangle == b._displayRectangle && a._id == b._id;
|
||||
|
||||
public static bool operator !=(AreaOfInterest a, AreaOfInterest b) => a._rectangle != b._rectangle || a._displayRectangle != b._displayRectangle || a._id != b._id;
|
||||
|
||||
public Rectangle Rectangle => _rectangle;
|
||||
|
||||
public Rectangle DisplayRectangle
|
||||
{
|
||||
get => _displayRectangle;
|
||||
set => _displayRectangle = value;
|
||||
}
|
||||
|
||||
public AreaOfInterestID Id => _id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.AreaOfInterestID
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
[Flags]
|
||||
internal enum AreaOfInterestID
|
||||
{
|
||||
Focus = 1,
|
||||
FocusOverride = 2,
|
||||
PendingFocus = 4,
|
||||
ScrollIntoViewRequest = 8,
|
||||
ScrollableRange = 16, // 0x00000010
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.AreaOfInterestLayoutInput
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Render;
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal class AreaOfInterestLayoutInput : ILayoutInput
|
||||
{
|
||||
private AreaOfInterestID _id;
|
||||
private Inset _margins;
|
||||
private static readonly DataCookie s_dataProperty = DataCookie.ReserveSlot();
|
||||
|
||||
public AreaOfInterestLayoutInput(AreaOfInterestID idName, Inset margins)
|
||||
{
|
||||
_id = idName;
|
||||
_margins = margins;
|
||||
}
|
||||
|
||||
public AreaOfInterestLayoutInput()
|
||||
{
|
||||
}
|
||||
|
||||
public AreaOfInterestID Id
|
||||
{
|
||||
get => _id;
|
||||
set => _id = value;
|
||||
}
|
||||
|
||||
public Inset Margins => _margins;
|
||||
|
||||
DataCookie ILayoutInput.Data => Data;
|
||||
|
||||
public static DataCookie Data => s_dataProperty;
|
||||
|
||||
public override string ToString() => InvariantString.Format("{0}({1})", GetType().Name, _id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.ExtendedLayoutOutput
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Library;
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal abstract class ExtendedLayoutOutput
|
||||
{
|
||||
public ExtendedLayoutOutput nextOutput;
|
||||
|
||||
private DataCookie Data => OutputID;
|
||||
|
||||
public abstract DataCookie OutputID { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.ILayout
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Render;
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal interface ILayout
|
||||
{
|
||||
Size Measure(ILayoutNode layoutNode, Size constraint);
|
||||
|
||||
void Arrange(ILayoutNode layoutNode, LayoutSlot slot);
|
||||
|
||||
ItemAlignment DefaultChildAlignment { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.ILayoutInput
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Library;
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal interface ILayoutInput
|
||||
{
|
||||
DataCookie Data { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.ILayoutNode
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Drawing;
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Render;
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal interface ILayoutNode
|
||||
{
|
||||
Size Measure(Size constraint);
|
||||
|
||||
void Arrange(LayoutSlot parentSlot);
|
||||
|
||||
void Arrange(LayoutSlot parentSlot, Rectangle bounds);
|
||||
|
||||
void Arrange(LayoutSlot parentSlot, Rectangle bounds, Vector3 scale, Rotation rotation);
|
||||
|
||||
void Commit();
|
||||
|
||||
void MarkHidden();
|
||||
|
||||
ILayoutInput GetLayoutInput(DataCookie inputID);
|
||||
|
||||
void SetLayoutInput(ILayoutInput input);
|
||||
|
||||
void SetLayoutInput(ILayoutInput input, bool invalidateLayout);
|
||||
|
||||
ExtendedLayoutOutput GetExtendedLayoutOutput(DataCookie outputID);
|
||||
|
||||
void SetExtendedLayoutOutput(ExtendedLayoutOutput newDataOutput);
|
||||
|
||||
bool ContainsAreaOfInterest(AreaOfInterestID id);
|
||||
|
||||
bool TryGetAreaOfInterest(AreaOfInterestID id, out AreaOfInterest area);
|
||||
|
||||
void AddAreaOfInterest(AreaOfInterest interest);
|
||||
|
||||
Vector<int> GetSpecificChildrenRequestList();
|
||||
|
||||
void RequestMoreChildren(int childrenCount);
|
||||
|
||||
void RequestSpecificChildren(Vector<int> indiciesList);
|
||||
|
||||
object MeasureData { get; set; }
|
||||
|
||||
int LayoutChildrenCount { get; }
|
||||
|
||||
LayoutNodeEnumerator LayoutChildren { get; }
|
||||
|
||||
ILayoutNode NextSibling { get; }
|
||||
|
||||
ILayoutNode NextVisibleSibling { get; }
|
||||
|
||||
bool LayoutContributesToWidth { get; set; }
|
||||
|
||||
void SetVisibleIndexRange(
|
||||
int beginVisible,
|
||||
int endVisible,
|
||||
int beginVisibleOffscreen,
|
||||
int endVisibleOffscreen,
|
||||
int? focusedItem);
|
||||
|
||||
Size DesiredSize { get; }
|
||||
|
||||
Size AlignedSize { get; }
|
||||
|
||||
Point AlignmentOffset { get; }
|
||||
|
||||
Point LayoutPosition { get; }
|
||||
|
||||
bool Visible { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.ItemAlignment
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Render;
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal struct ItemAlignment
|
||||
{
|
||||
private Alignment _horizontal;
|
||||
private Alignment _vertical;
|
||||
internal static readonly ItemAlignment Default = new ItemAlignment();
|
||||
|
||||
public ItemAlignment(Alignment horizontal, Alignment vertical)
|
||||
{
|
||||
_horizontal = horizontal;
|
||||
_vertical = vertical;
|
||||
}
|
||||
|
||||
public Alignment Horizontal
|
||||
{
|
||||
get => _horizontal;
|
||||
set => _horizontal = value;
|
||||
}
|
||||
|
||||
public Alignment Vertical
|
||||
{
|
||||
get => _vertical;
|
||||
set => _vertical = value;
|
||||
}
|
||||
|
||||
public Alignment GetAlignment(Orientation orientation) => orientation != Orientation.Horizontal ? Vertical : Horizontal;
|
||||
|
||||
public override bool Equals(object obj) => obj is ItemAlignment itemAlignment && this == itemAlignment;
|
||||
|
||||
public override int GetHashCode() => (int)((Alignment)((int)Horizontal << 16) ^ Vertical);
|
||||
|
||||
public static bool operator ==(ItemAlignment left, ItemAlignment right) => left.Horizontal == right.Horizontal && left.Vertical == right.Vertical;
|
||||
|
||||
public static bool operator !=(ItemAlignment left, ItemAlignment right) => !(left == right);
|
||||
|
||||
public static ItemAlignment Merge(ItemAlignment alignment, ItemAlignment fallback)
|
||||
{
|
||||
if (alignment.Horizontal == Alignment.Unspecified)
|
||||
alignment.Horizontal = fallback.Horizontal;
|
||||
if (alignment.Vertical == Alignment.Unspecified)
|
||||
alignment.Vertical = fallback.Vertical;
|
||||
return alignment;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.LayoutCompleteEventHandler
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal delegate void LayoutCompleteEventHandler(object sender);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.LayoutConstants
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal static class LayoutConstants
|
||||
{
|
||||
public const int Infinite = 16777215;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.LayoutNodeEnumerator
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal struct LayoutNodeEnumerator
|
||||
{
|
||||
private ILayoutNode _start;
|
||||
private ILayoutNode _current;
|
||||
private bool _haventStartedYet;
|
||||
|
||||
public LayoutNodeEnumerator GetEnumerator() => this;
|
||||
|
||||
public LayoutNodeEnumerator(ILayoutNode start)
|
||||
{
|
||||
_start = start;
|
||||
_current = null;
|
||||
_haventStartedYet = true;
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
if (_current != null)
|
||||
_current = _current.NextVisibleSibling;
|
||||
else if (_haventStartedYet)
|
||||
{
|
||||
_current = _start;
|
||||
_haventStartedYet = false;
|
||||
}
|
||||
return _current != null;
|
||||
}
|
||||
|
||||
public ILayoutNode Current => _current;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_current = null;
|
||||
_haventStartedYet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.LayoutSlot
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Render;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal struct LayoutSlot
|
||||
{
|
||||
private Size _bounds;
|
||||
private Point _offset;
|
||||
private Rectangle _viewBounds;
|
||||
private Rectangle _peripheralViewBounds;
|
||||
|
||||
public LayoutSlot(Size extent)
|
||||
: this(extent, Point.Zero, new Rectangle(extent), new Rectangle(extent))
|
||||
{
|
||||
}
|
||||
|
||||
public LayoutSlot(
|
||||
Size extent,
|
||||
Point offset,
|
||||
Rectangle viewBounds,
|
||||
Rectangle viewPeripheralBounds)
|
||||
{
|
||||
_bounds = extent;
|
||||
_offset = offset;
|
||||
_viewBounds = viewBounds;
|
||||
_peripheralViewBounds = viewPeripheralBounds;
|
||||
}
|
||||
|
||||
public Size Bounds
|
||||
{
|
||||
get => _bounds;
|
||||
set => _bounds = value;
|
||||
}
|
||||
|
||||
public Point Offset
|
||||
{
|
||||
get => _offset;
|
||||
set => _offset = value;
|
||||
}
|
||||
|
||||
public Rectangle View
|
||||
{
|
||||
get => _viewBounds;
|
||||
set => _viewBounds = value;
|
||||
}
|
||||
|
||||
public Rectangle PeripheralView
|
||||
{
|
||||
get => _peripheralViewBounds;
|
||||
set => _peripheralViewBounds = value;
|
||||
}
|
||||
|
||||
public void Deflate(Inset inset)
|
||||
{
|
||||
int num1 = inset.Left + inset.Right;
|
||||
int num2 = inset.Top + inset.Bottom;
|
||||
_bounds.Width -= num1;
|
||||
if (_bounds.Width < 0)
|
||||
_bounds.Width = 0;
|
||||
_bounds.Height -= num2;
|
||||
if (_bounds.Height < 0)
|
||||
_bounds.Height = 0;
|
||||
_viewBounds.X -= inset.Left;
|
||||
_viewBounds.Y -= inset.Top;
|
||||
_peripheralViewBounds.X -= inset.Left;
|
||||
_peripheralViewBounds.Y -= inset.Top;
|
||||
}
|
||||
|
||||
public static bool operator ==(LayoutSlot left, LayoutSlot right) => left._bounds == right._bounds && left._offset == right._offset && left._viewBounds == right._viewBounds && left._peripheralViewBounds == right._peripheralViewBounds;
|
||||
|
||||
public static bool operator !=(LayoutSlot left, LayoutSlot right) => !(left == right);
|
||||
|
||||
public override bool Equals(object obj) => obj is LayoutSlot layoutSlot && this == layoutSlot;
|
||||
|
||||
public override int GetHashCode() => _bounds.GetHashCode() ^ _offset.GetHashCode() ^ _viewBounds.GetHashCode() ^ _peripheralViewBounds.GetHashCode();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.Append(GetType().Name);
|
||||
stringBuilder.Append("(");
|
||||
stringBuilder.Append("Bounds=");
|
||||
stringBuilder.Append(_bounds);
|
||||
stringBuilder.Append(", Offset=");
|
||||
stringBuilder.Append(_offset);
|
||||
stringBuilder.Append(", View=");
|
||||
stringBuilder.Append(_viewBounds);
|
||||
if (_peripheralViewBounds != _viewBounds)
|
||||
{
|
||||
stringBuilder.Append(", Peripheral=");
|
||||
stringBuilder.Append(_peripheralViewBounds);
|
||||
}
|
||||
stringBuilder.Append(")");
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.SharedSize
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Markup;
|
||||
using Microsoft.Iris.Render;
|
||||
using Microsoft.Iris.Session;
|
||||
using Microsoft.Iris.UI;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal class SharedSize : NotifyObjectBase
|
||||
{
|
||||
private Size _minimumSize;
|
||||
private Size _maximumSize;
|
||||
private Size _desiredSize;
|
||||
private bool _accumulatingSize;
|
||||
private bool _applyPending;
|
||||
private Vector<ViewItem> _dependents;
|
||||
|
||||
public SharedSize()
|
||||
{
|
||||
_minimumSize = Size.Zero;
|
||||
_maximumSize = Size.Zero;
|
||||
_desiredSize = Size.Zero;
|
||||
_accumulatingSize = true;
|
||||
}
|
||||
|
||||
public Size MaximumSize
|
||||
{
|
||||
get => _maximumSize;
|
||||
set
|
||||
{
|
||||
if (!(_maximumSize != value))
|
||||
return;
|
||||
Size size1 = Size;
|
||||
_maximumSize = value;
|
||||
Size size2 = Size;
|
||||
FireNotification(NotificationID.MaximumSize);
|
||||
if (!(size1 != size2))
|
||||
return;
|
||||
FireNotification(NotificationID.Size);
|
||||
InvalidateDependents(true);
|
||||
}
|
||||
}
|
||||
|
||||
public Size MinimumSize
|
||||
{
|
||||
get => _minimumSize;
|
||||
set
|
||||
{
|
||||
if (!(_minimumSize != value))
|
||||
return;
|
||||
Size size1 = Size;
|
||||
_minimumSize = value;
|
||||
Size size2 = Size;
|
||||
FireNotification(NotificationID.MinimumSize);
|
||||
if (!(size1 != size2))
|
||||
return;
|
||||
FireNotification(NotificationID.Size);
|
||||
InvalidateDependents(true);
|
||||
}
|
||||
}
|
||||
|
||||
public Size Size
|
||||
{
|
||||
get
|
||||
{
|
||||
Size size = Size.Max(_desiredSize, MinimumSize);
|
||||
Size maximumSize = MaximumSize;
|
||||
if (maximumSize.Width > 0)
|
||||
size.Width = Math.Min(size.Width, maximumSize.Width);
|
||||
if (maximumSize.Height > 0)
|
||||
size.Height = Math.Min(size.Height, maximumSize.Height);
|
||||
return size;
|
||||
}
|
||||
set => SetSize(value, true);
|
||||
}
|
||||
|
||||
public void AutoSize()
|
||||
{
|
||||
SetSize(Size.Zero, false);
|
||||
InvalidateDependents(true);
|
||||
}
|
||||
|
||||
private void SetSize(Size value, bool stopAccumulating)
|
||||
{
|
||||
if (_desiredSize != value)
|
||||
{
|
||||
Size size1 = Size;
|
||||
_desiredSize = value;
|
||||
Size size2 = Size;
|
||||
if (size1 != size2)
|
||||
{
|
||||
FireNotification(NotificationID.Size);
|
||||
if (stopAccumulating)
|
||||
InvalidateDependents(true);
|
||||
}
|
||||
}
|
||||
_accumulatingSize = !stopAccumulating;
|
||||
}
|
||||
|
||||
public void Register(ViewItem viewitem)
|
||||
{
|
||||
if (_dependents == null)
|
||||
_dependents = new Vector<ViewItem>();
|
||||
_dependents.Add(viewitem);
|
||||
}
|
||||
|
||||
public void Unregister(ViewItem viewitem) => _dependents.Remove(viewitem);
|
||||
|
||||
public void AdjustConstraint(ref Size constraint, ref Size minSize, SharedSizePolicy policy)
|
||||
{
|
||||
Size size1 = Size;
|
||||
Size maximumSize = MaximumSize;
|
||||
Size size2 = constraint;
|
||||
Size size3 = size1;
|
||||
Size size4 = minSize;
|
||||
if ((policy & SharedSizePolicy.SharesWidth) != 0)
|
||||
{
|
||||
if (!_accumulatingSize)
|
||||
{
|
||||
int num = Math.Max(size4.Width, Math.Min(size1.Width, size2.Width));
|
||||
if (num >= MinimumSize.Width && (num <= maximumSize.Width || maximumSize.Width == 0))
|
||||
{
|
||||
size4.Width = num;
|
||||
size2.Width = num;
|
||||
}
|
||||
else
|
||||
{
|
||||
size2.Width = 0;
|
||||
size4.Width = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (maximumSize.Width != 0)
|
||||
size2.Width = Math.Min(maximumSize.Width, size2.Width);
|
||||
size4.Width = Math.Max(size3.Width, size4.Width);
|
||||
}
|
||||
}
|
||||
if ((policy & SharedSizePolicy.SharesHeight) != 0)
|
||||
{
|
||||
if (!_accumulatingSize)
|
||||
{
|
||||
int num = Math.Max(size4.Height, Math.Min(size1.Height, size2.Height));
|
||||
if (num >= MinimumSize.Height && (num <= maximumSize.Height || maximumSize.Height == 0))
|
||||
{
|
||||
size4.Height = num;
|
||||
size2.Height = num;
|
||||
}
|
||||
else
|
||||
{
|
||||
size2.Height = 0;
|
||||
size4.Height = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (maximumSize.Height != 0)
|
||||
size2.Height = Math.Min(maximumSize.Height, size2.Height);
|
||||
size4.Height = Math.Max(size3.Height, size4.Height);
|
||||
}
|
||||
}
|
||||
constraint = size2;
|
||||
minSize = size4;
|
||||
}
|
||||
|
||||
public void AccumulateSize(Size size, SharedSizePolicy policy)
|
||||
{
|
||||
if (!_accumulatingSize)
|
||||
return;
|
||||
Size size1 = Size;
|
||||
if ((policy & SharedSizePolicy.ContributesToWidth) != 0 && size.Width > size1.Width)
|
||||
size1.Width = size.Width;
|
||||
if ((policy & SharedSizePolicy.ContributesToHeight) != 0 && size.Height > size1.Height)
|
||||
size1.Height = size.Height;
|
||||
SetSize(size1, false);
|
||||
EnsureApplySize();
|
||||
}
|
||||
|
||||
private void EnsureApplySize()
|
||||
{
|
||||
if (_applyPending)
|
||||
return;
|
||||
_applyPending = true;
|
||||
DeferredCall.Post(DispatchPriority.LayoutPass2, new SimpleCallback(ApplySize));
|
||||
}
|
||||
|
||||
private void ApplySize()
|
||||
{
|
||||
_accumulatingSize = false;
|
||||
_applyPending = false;
|
||||
InvalidateDependents(false);
|
||||
}
|
||||
|
||||
private void InvalidateDependents(bool forceInvalid)
|
||||
{
|
||||
if (_dependents == null)
|
||||
return;
|
||||
Size size1 = Size;
|
||||
foreach (ViewItem dependent in _dependents)
|
||||
{
|
||||
if (forceInvalid)
|
||||
{
|
||||
dependent.MarkLayoutInvalid();
|
||||
}
|
||||
else
|
||||
{
|
||||
SharedSizePolicy sharedSizePolicy = dependent.SharedSizePolicy;
|
||||
Size size2 = ((ILayoutNode)dependent).DesiredSize - dependent.Margins.Size;
|
||||
if (size1.Width != size2.Width && (sharedSizePolicy & SharedSizePolicy.SharesWidth) != 0 || size1.Height != size2.Height && (sharedSizePolicy & SharedSizePolicy.SharesHeight) != 0)
|
||||
dependent.MarkLayoutInvalid();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.SharedSizePolicy
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
[Flags]
|
||||
internal enum SharedSizePolicy
|
||||
{
|
||||
ContributesToWidth = 1,
|
||||
ContributesToHeight = 2,
|
||||
ContributesToSize = ContributesToHeight | ContributesToWidth, // 0x00000003
|
||||
SharesWidth = 4,
|
||||
SharesHeight = 8,
|
||||
SharesSize = SharesHeight | SharesWidth, // 0x0000000C
|
||||
Default = SharesSize | ContributesToSize, // 0x0000000F
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Layout.Visibility
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Layout
|
||||
{
|
||||
internal enum Visibility : byte
|
||||
{
|
||||
Visible,
|
||||
ImplicitlyHidden,
|
||||
ExplicitlyHidden,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user