70 instantiations of PanelRect
Aspire.Tray.Tests (70)
src\Aspire.Tray\Common\TrayPanel.cs (49)
807
_viewport =
new
(0, HeaderHeight + noticeHeight, Width, Math.Max(0, height - chrome));
813
var panel = new
PanelRect
(0, 0, Width, height);
814
var footer = new
PanelRect
(0, height - FooterHeight, Width, FooterHeight);
817
commands.Add(new FillPathCommand(PanelPath.Rectangle(
new
(0, footer.Y, Width, 1)), palette.Separator));
820
commands.Add(new FillPathCommand(PanelPath.RoundedRect(
new
(0, 0, Width, HeaderHeight), CornerRadius, CornerRadius, 0, 0), palette.Gutter));
821
commands.Add(new FillPathCommand(PanelPath.Rectangle(
new
(0, HeaderHeight - 1, Width, 1)), palette.Separator));
839
commands.Add(new FillPathCommand(PanelPath.Rectangle(
new
(0, _viewport.Y, Width, 1)), palette.Separator));
859
var headerBounds = new
PanelRect
(20, top + 4, 200, 24);
892
commands.Add(new FillPathCommand(PanelPath.RoundedRect(
new
(Width - 7, thumbY, 4, thumb), 2), palette.TextTertiary.WithAlpha(0.4)));
930
commands.Add(new LogoCommand(
new
(20, middle - 10, 20, 20)));
931
var title = new
PanelRect
(TextLeft, middle - 10, HeaderTitleWidth, 20);
937
var statusBounds = new
PanelRect
(statusLeft, middle - 8, Width - statusLeft - 16, 16);
944
var banner = new
PanelRect
(12, HeaderHeight + 8, Width - 24, height);
951
TrayPanelGlyphs.AddIcon(commands, PanelIcon.Alert,
new
(banner.X + 10, banner.Y + 9, 16, 16), palette.BannerText);
952
var text = new
PanelRect
(banner.X + 34, banner.Y + 8, NoticeTextWidth, height - 16);
966
var art = new
PanelRect
(Width / 2 - 16, top + 20, 32, 32);
975
var titleBounds = new
PanelRect
(20, top + 62, Width - 40, 20);
976
var hintBounds = new
PanelRect
(44, top + 84, Width - 88, 34);
993
var labelBounds = new
PanelRect
(20, top + 4, 200, 24);
1003
var toggle = new
PanelRect
(RowInset, top + 4, Width - 2 * RowInset, 24);
1008
new
(RowContentRight - 22, top + 8, 16, 16), palette.TextTertiary);
1014
var clear = new
PanelRect
(RowContentRight - 30 - 52, top + 6, 52, 20);
1026
var row = new
PanelRect
(RowInset, top + 2, Width - 2 * RowInset, RowHeight - 4);
1037
TrayPanelGlyphs.AddStatus(commands, GetStatusGlyph(host, live),
new
(20, top + 16, 20, 20), palette);
1044
commands.Add(new TextCommand(
new
(TextLeft, top + 8, textRight - TextLeft, 18), host.DisplayName, PanelFontRole.Name, palette.TextPrimary));
1045
commands.Add(new TextCommand(
new
(TextLeft, top + 27, textRight - TextLeft, 16), detail, PanelFontRole.Body,
1052
var bounds = new
PanelRect
(x, top + (RowHeight - ButtonSize) / 2, ButtonSize, ButtonSize);
1143
var card = new
PanelRect
(RowInset, top, Width - 2 * RowInset, height - ActionListGap);
1149
var item = new
PanelRect
(card.X + ActionListPadding, y, card.Width - 2 * ActionListPadding, ActionItemHeight);
1158
TrayPanelGlyphs.AddIcon(fallback, PanelIcon.AppWindow,
new
(TextLeft, item.Y + 7, 16, 16), iconColor);
1159
commands.Add(new AppIconCommand(
new
(TextLeft, item.Y + 7, 16, 16), _openInApplications[index], fallback));
1160
commands.Add(new TextCommand(
new
(TextLeft + 26, item.Y, item.Right - 8 - TextLeft - 26, item.Height), label,
1166
TrayPanelGlyphs.AddIcon(commands, icon,
new
(22, item.Y + 7, 16, 16), iconColor);
1173
new
(item.Right - 8 - 16, item.Y + 7, 16, 16), palette.TextTertiary);
1175
commands.Add(new TextCommand(
new
(TextLeft, item.Y, labelRight - TextLeft, item.Height), label, PanelFontRole.Body, palette.TextPrimary));
1215
var card = new
PanelRect
(RowInset, top + 4, Width - 2 * RowInset, ConfirmHeight - 8);
1226
var questionBounds = new
PanelRect
(card.X + 12, card.Y + 9, textWidth, 18);
1227
var detailBounds = new
PanelRect
(card.X + 12, card.Y + 28, textWidth, 16);
1238
var acceptBounds = new
PanelRect
(card.Right - 10 - ButtonWidth, controlsY, ButtonWidth, ButtonSize);
1239
var cancelBounds = new
PanelRect
(acceptBounds.X - 8 - ButtonWidth, controlsY, ButtonWidth, ButtonSize);
1268
var back = new
PanelRect
(12, (HeaderHeight - ButtonSize) / 2, ButtonSize, ButtonSize);
1273
var title = new
PanelRect
(back.Right + 8, (HeaderHeight - 20) / 2, Width - back.Right - 24, 20);
1281
var row = new
PanelRect
(RowInset, top + 2, Width - 2 * RowInset, SettingsRowHeight - 4);
1295
var toggle = new
PanelRect
(RowContentRight - 36, top + 9, 32, 18);
1297
commands.Add(new TextCommand(
new
(20, top + 8, textWidth, 20), title, PanelFontRole.Name,
1299
commands.Add(new TextCommand(
new
(20, top + 28, textWidth, 30), description, PanelFontRole.Body,
1307
var name = new
PanelRect
(20, top + 4, Width - 40, 20);
1317
var bounds = new
PanelRect
(20, y, Width - 40, 16);
1339
var bounds = new
PanelRect
(x, footer.Y + 8, ButtonSize, ButtonSize);
src\Aspire.Tray\Common\TrayPanelGeometry.cs (4)
24
public PanelRect Inset(double dx, double dy) =>
new
(X + dx, Y + dy, Width - 2 * dx, Height - 2 * dy);
26
public PanelRect Offset(double dx, double dy) =>
new
(X + dx, Y + dy, Width, Height);
34
return right <= x || bottom <= y ? default :
new
(x, y, right - x, bottom - y);
205
return minX > maxX ? default :
new
(minX, minY, maxX - minX, maxY - minY);
src\Aspire.Tray\Common\TrayPanelGlyphs.cs (5)
81
Fill(PanelPath.RoundedRect(
new
(7, 7, 6, 6), 1.4), palette.Neutral);
112
Fill(PanelPath.RoundedRect(
new
(4.25, 4.25, 7.5, 7.5), 1.5));
156
Stroke(PanelPath.RoundedRect(
new
(2.25, 3, 11.5, 10), 1.75), 1.4);
167
Stroke(PanelPath.RoundedRect(
new
(5.75, 5.75, 7.5, 7.5), 1.5), 1.4);
208
var track = new
PanelRect
(0, 0, ToggleDesignWidth, ToggleDesignHeight);
TrayPanelTests.cs (12)
72
var bounds = new
PanelRect
(0, 0, scene.Width, scene.Height);
762
var box = new
PanelRect
(10, 20, 32, 18);
871
Assert.Contains(gutters, bounds => Near(bounds,
new
(0, 0, TrayPanel.Width, TrayPanel.HeaderHeight)));
872
Assert.Contains(gutters, bounds => Near(bounds,
new
(0, scene.Height - TrayPanel.FooterHeight, TrayPanel.Width, TrayPanel.FooterHeight)));
875
Assert.Contains(new
PanelRect
(0, TrayPanel.HeaderHeight - 1, TrayPanel.Width, 1), separators);
876
Assert.Contains(new
PanelRect
(0, scene.Height - TrayPanel.FooterHeight, TrayPanel.Width, 1), separators);
883
Assert.All(scene.Commands.OfType<LogoCommand>(), logo => Assert.Equal(new
PanelRect
(20, middle - 10, 20, 20), logo.Bounds));
950
var rect = new
PanelRect
(8, 10, 100, 40);
968
var box = new
PanelRect
(40, 60, 20, 20);
997
var box = new
PanelRect
(4, 8, 16, 16);
1054
TrayPanelGlyphs.AddStatus(commands, PanelStatusGlyph.Unhealthy,
new
(0, 0, 20, 20), palette);
1099
TrayPanelGlyphs.AddStatus(commands, glyph,
new
(0, 0, 20, 20), palette);
71 references to PanelRect
Aspire.Tray.Tests (71)
Helpers\TrayPanelSvgRenderer.cs (1)
203
private static object[] Bounds(
PanelRect
rect)
src\Aspire.Tray\Common\TrayPanel.cs (37)
56
private
PanelRect
_viewport;
112
public
PanelRect
Viewport
813
var
panel = new PanelRect(0, 0, Width, height);
814
var
footer = new PanelRect(0, height - FooterHeight, Width, FooterHeight);
859
var
headerBounds = new PanelRect(20, top + 4, 200, 24);
910
var
clip = IsChrome(focused.Kind) ? panel : _viewport;
931
var
title = new PanelRect(TextLeft, middle - 10, HeaderTitleWidth, 20);
937
var
statusBounds = new PanelRect(statusLeft, middle - 8, Width - statusLeft - 16, 16);
944
var
banner = new PanelRect(12, HeaderHeight + 8, Width - 24, height);
952
var
text = new PanelRect(banner.X + 34, banner.Y + 8, NoticeTextWidth, height - 16);
966
var
art = new PanelRect(Width / 2 - 16, top + 20, 32, 32);
975
var
titleBounds = new PanelRect(20, top + 62, Width - 40, 20);
976
var
hintBounds = new PanelRect(44, top + 84, Width - 88, 34);
993
var
labelBounds = new PanelRect(20, top + 4, 200, 24);
1003
var
toggle = new PanelRect(RowInset, top + 4, Width - 2 * RowInset, 24);
1014
var
clear = new PanelRect(RowContentRight - 30 - 52, top + 6, 52, 20);
1026
var
row = new PanelRect(RowInset, top + 2, Width - 2 * RowInset, RowHeight - 4);
1052
var
bounds = new PanelRect(x, top + (RowHeight - ButtonSize) / 2, ButtonSize, ButtonSize);
1143
var
card = new PanelRect(RowInset, top, Width - 2 * RowInset, height - ActionListGap);
1149
var
item = new PanelRect(card.X + ActionListPadding, y, card.Width - 2 * ActionListPadding, ActionItemHeight);
1215
var
card = new PanelRect(RowInset, top + 4, Width - 2 * RowInset, ConfirmHeight - 8);
1226
var
questionBounds = new PanelRect(card.X + 12, card.Y + 9, textWidth, 18);
1227
var
detailBounds = new PanelRect(card.X + 12, card.Y + 28, textWidth, 16);
1238
var
acceptBounds = new PanelRect(card.Right - 10 - ButtonWidth, controlsY, ButtonWidth, ButtonSize);
1239
var
cancelBounds = new PanelRect(acceptBounds.X - 8 - ButtonWidth, controlsY, ButtonWidth, ButtonSize);
1268
var
back = new PanelRect(12, (HeaderHeight - ButtonSize) / 2, ButtonSize, ButtonSize);
1273
var
title = new PanelRect(back.Right + 8, (HeaderHeight - 20) / 2, Width - back.Right - 24, 20);
1281
var
row = new PanelRect(RowInset, top + 2, Width - 2 * RowInset, SettingsRowHeight - 4);
1295
var
toggle = new PanelRect(RowContentRight - 36, top + 9, 32, 18);
1307
var
name = new PanelRect(20, top + 4, Width - 40, 20);
1317
var
bounds = new PanelRect(20, y, Width - 40, 16);
1324
private void AddFooter(List<PanelCommand> commands, List<PanelHitTarget> targets,
PanelRect
footer, TrayPanelPalette palette)
1339
var
bounds = new PanelRect(x, footer.Y + 8, ButtonSize, ButtonSize);
1352
private void AddInteractionFill(List<PanelCommand> commands, PanelTargetKey key,
PanelRect
bounds, TrayPanelPalette palette, bool includeFocus)
1363
private void AddTarget(List<PanelHitTarget> targets, PanelTargetKey key,
PanelRect
bounds, string name, bool enabled, AppHostMenuItem? host,
1366
var
hit = IsChrome(key.Kind) ? bounds : bounds.Intersect(_viewport);
1376
private void AddLabel(string label, string text,
PanelRect
bounds, bool chrome)
src\Aspire.Tray\Common\TrayPanelGeometry.cs (10)
20
public bool Contains(
PanelRect
other) => other.X >= X && other.Y >= Y && other.Right <= Right && other.Bottom <= Bottom;
22
public bool IntersectsWith(
PanelRect
other) => other.X < Right && X < other.Right && other.Y < Bottom && Y < other.Bottom;
24
public
PanelRect
Inset(double dx, double dy) => new(X + dx, Y + dy, Width - 2 * dx, Height - 2 * dy);
26
public
PanelRect
Offset(double dx, double dy) => new(X + dx, Y + dy, Width, Height);
28
public
PanelRect
Intersect(
PanelRect
other)
133
public static PanelPath Rectangle(
PanelRect
rect)
137
public static PanelPath RoundedRect(
PanelRect
rect, double radius)
141
public static PanelPath RoundedRect(
PanelRect
rect, double topLeft, double topRight, double bottomRight, double bottomLeft)
188
public
PanelRect
GetControlBounds()
src\Aspire.Tray\Common\TrayPanelGlyphs.cs (4)
52
public static void AddStatus(List<PanelCommand> commands, PanelStatusGlyph glyph,
PanelRect
bounds, TrayPanelPalette palette)
97
public static void AddIcon(List<PanelCommand> commands, PanelIcon icon,
PanelRect
bounds, PanelColor color)
204
public static void AddToggle(List<PanelCommand> commands, bool on, bool enabled,
PanelRect
bounds, TrayPanelPalette palette)
208
var
track = new PanelRect(0, 0, ToggleDesignWidth, ToggleDesignHeight);
src\Aspire.Tray\Common\TrayPanelScene.cs (9)
64
PanelRect
Bounds,
73
internal sealed record LogoCommand(
PanelRect
Bounds) : PanelCommand;
80
internal sealed record AppIconCommand(
PanelRect
Bounds, string Application, IReadOnlyList<PanelCommand> Fallback) : PanelCommand;
83
internal sealed record PushClipCommand(
PanelRect
Bounds) : PanelCommand;
173
PanelRect
Bounds,
174
PanelRect
HitBounds,
205
PanelRect
Bounds,
206
PanelRect
VisibleBounds,
271
internal sealed record PanelAction(PanelActionKind Kind, AppHostMenuItem? Host = null,
PanelRect
Anchor = default)
TrayPanelTests.cs (10)
72
var
bounds = new PanelRect(0, 0, scene.Width, scene.Height);
468
var
footer = scene.Targets.Single(target => target.Kind == PanelTargetKind.Quit).Bounds;
762
var
box = new PanelRect(10, 20, 32, 18);
869
static bool Near(
PanelRect
a,
PanelRect
b)
950
var
rect = new PanelRect(8, 10, 100, 40);
968
var
box = new PanelRect(40, 60, 20, 20);
997
var
box = new PanelRect(4, 8, 16, 16);
1353
private static PanelResponse Click(TrayPanel panel,
PanelRect
bounds, double? offsetX = null)
1372
private static
PanelRect
GetBounds(PanelCommand command)