Add MaxWidth property to Text and set in Window title rendering

This commit is contained in:
Stone_Red
2026-06-16 20:03:19 +02:00
parent 7f4dc45742
commit f049a43dfd
2 changed files with 8 additions and 0 deletions
+7
View File
@@ -24,6 +24,12 @@ public class Text() : UIElement("Text")
set => SetProperty(nameof(FontSize), ref field, value); set => SetProperty(nameof(FontSize), ref field, value);
} = 12; } = 12;
public int MaxWidth
{
get;
set => SetProperty(nameof(MaxWidth), ref field, value);
} = int.MaxValue;
public override IEnumerable<RenderCommand> ToPrimitives(int windowId) public override IEnumerable<RenderCommand> ToPrimitives(int windowId)
{ {
yield return new RenderCommand yield return new RenderCommand
@@ -37,6 +43,7 @@ public class Text() : UIElement("Text")
["Color"] = Color, ["Color"] = Color,
["Content"] = Content, ["Content"] = Content,
["FontSize"] = FontSize, ["FontSize"] = FontSize,
["MaxWidth"] = MaxWidth,
} }
}; };
} }
+1
View File
@@ -324,6 +324,7 @@ public sealed class Window(string title, int processId, int id, IRenderSource re
["Color"] = Color.White, ["Color"] = Color.White,
["Content"] = Title, ["Content"] = Title,
["FontSize"] = 18, ["FontSize"] = 18,
["MaxWidth"] = Size.Width - 8,
} }
}); });
} }