Add public PredefinedLayouts

This commit is contained in:
Yoshi Askharoun
2024-02-18 22:23:59 -06:00
parent 3bd3531f44
commit 2e5eaedcdc
16 changed files with 191 additions and 32 deletions
@@ -350,6 +350,15 @@ namespace Microsoft.Iris.Layouts
return null;
}
public bool Equals(ILayout other)
{
if (other is not AnchorLayout o) return false;
return DefaultChildAlignment == o.DefaultChildAlignment
&& SizeToHorizontalChildren == o.SizeToHorizontalChildren
&& SizeToVerticalChildren == o.SizeToVerticalChildren;
}
internal static DataCookie InputData => s_dataProperty;
internal enum LayoutPhase
@@ -6,6 +6,7 @@
using Microsoft.Iris.Layout;
using Microsoft.Iris.Render;
using System;
namespace Microsoft.Iris.Layouts
{
@@ -42,5 +43,12 @@ namespace Microsoft.Iris.Layouts
foreach (ILayoutNode layoutChild in layoutNode.LayoutChildren)
layoutChild.Arrange(slot);
}
public bool Equals(ILayout other)
{
if (other is not DefaultLayout o) return false;
return DefaultChildAlignment == o.DefaultChildAlignment;
}
}
}
+8
View File
@@ -120,5 +120,13 @@ namespace Microsoft.Iris.Layouts
dockLayoutInput = _defaultLayoutInput ?? s_defaultLayoutInput;
return dockLayoutInput;
}
public bool Equals(ILayout other)
{
if (other is not DockLayout o) return false;
return DefaultChildAlignment == o.DefaultChildAlignment
&& DefaultLayoutInput.ToString() == other.DefaultChildAlignment.ToString();
}
}
}
+15
View File
@@ -696,6 +696,21 @@ namespace Microsoft.Iris.Layouts
return majorMinor;
}
public bool Equals(ILayout other)
{
if (other is not FlowLayout o) return false;
return DefaultChildAlignment == o.DefaultChildAlignment
&& Orientation == o.Orientation
&& Spacing == o.Spacing
&& AllowWrap == o.AllowWrap
&& StripAlignment == o.StripAlignment
&& Repeat == o.Repeat
&& RepeatGap == o.RepeatGap
&& MissingItemPolicy == o.MissingItemPolicy
&& MinimumSampleSize == o.MinimumSampleSize;
}
internal class Record
{
public int Index;
+14
View File
@@ -538,6 +538,20 @@ namespace Microsoft.Iris.Layouts
return roundUp ? (int)Math.Ceiling(num) : (int)Math.Floor(num);
}
public bool Equals(ILayout other)
{
if (other is not GridLayout o) return false;
return DefaultChildAlignment == o.DefaultChildAlignment
&& Orientation == o.Orientation
&& ReferenceSize == o.ReferenceSize
&& Rows == o.Rows
&& Columns == o.Columns
&& Spacing == o.Spacing
&& Repeat == o.Repeat
&& RepeatGap == o.RepeatGap;
}
private enum ViewIntersectionType
{
BeginOffscreen,
@@ -12,6 +12,7 @@ using Microsoft.Iris.Render;
using Microsoft.Iris.RenderAPI.Drawing;
using Microsoft.Iris.Session;
using Microsoft.Iris.UI;
using Microsoft.Iris.ViewItems;
using System;
using System.Collections;
@@ -271,6 +272,13 @@ namespace Microsoft.Iris.Layouts
}
}
public bool Equals(ILayout other)
{
if (other is not PopupLayout o) return false;
return DefaultChildAlignment == o.DefaultChildAlignment;
}
private class PlacementTargetInfo
{
public ViewItem child;
@@ -71,5 +71,13 @@ namespace Microsoft.Iris.Layouts
private static Rectangle RotateRect180(Rectangle rect, Point offset) => new Rectangle(-rect.Right + offset.X, -rect.Bottom + offset.Y, rect.Width, rect.Height);
private static Rectangle RotateRect270(Rectangle rect, Point offset) => new Rectangle(-rect.Bottom + offset.X, rect.X + offset.Y, rect.Height, rect.Width);
public bool Equals(ILayout other)
{
if (other is not RotateLayout o) return false;
return DefaultChildAlignment == o.DefaultChildAlignment
&& AngleDegrees == o.AngleDegrees;
}
}
}
+11
View File
@@ -8,6 +8,7 @@ using Microsoft.Iris.Drawing;
using Microsoft.Iris.Layout;
using Microsoft.Iris.Render;
using Microsoft.Iris.RenderAPI.Drawing;
using Microsoft.Iris.ViewItems;
using System;
namespace Microsoft.Iris.Layouts
@@ -92,5 +93,15 @@ namespace Microsoft.Iris.Layouts
view.Height = (int)Math.Round(view.Height / (double)scale.Height);
return view;
}
public bool Equals(ILayout other)
{
if (other is not ScaleLayout o) return false;
return DefaultChildAlignment == o.DefaultChildAlignment
&& MinimumScale == o.MinimumScale
&& MaximumScale == o.MaximumScale
&& MaintainAspectRatio == o.MaintainAspectRatio;
}
}
}
@@ -329,5 +329,14 @@ namespace Microsoft.Iris.Layouts
public static bool ScrollFocusIntoView => s_allowScrollFocusIntoView;
public static void DisallowScrollFocusIntoView() => s_allowScrollFocusIntoView = false;
public bool Equals(ILayout other)
{
if (other is not ScrollingLayout o) return false;
return DefaultChildAlignment == o.DefaultChildAlignment
&& Orientation == o.Orientation
&& Prefetch == o.Prefetch;
}
}
}
@@ -7,6 +7,7 @@
using Microsoft.Iris.Layout;
using Microsoft.Iris.Library;
using Microsoft.Iris.Render;
using Microsoft.Iris.ViewItems;
using System;
namespace Microsoft.Iris.Layouts
@@ -96,5 +97,12 @@ namespace Microsoft.Iris.Layouts
stackLayoutInput = s_defaultLayoutInput;
return stackLayoutInput;
}
public bool Equals(ILayout other)
{
if (other is not StackLayout o) return false;
return DefaultChildAlignment == o.DefaultChildAlignment;
}
}
}