Files
maui-linux/Handlers/StackLayoutHandler.cs
Dave Friedel 1f096c38dc Update with recovered code from VM binaries (Jan 1)
Recovered from decompiled OpenMaui.Controls.Linux.dll:
- SkiaShell.cs: FlyoutHeader, FlyoutFooter, scroll support (918 -> 1325 lines)
- X11Window.cs: Cursor support (XCreateFontCursor, XDefineCursor)
- All handlers with dark mode support
- All services with latest implementations
- LinuxApplication with theme change handling
2026-01-01 06:22:48 -05:00

50 lines
1.7 KiB
C#

using Microsoft.Maui.Controls;
using Microsoft.Maui.Handlers;
namespace Microsoft.Maui.Platform.Linux.Handlers;
public class StackLayoutHandler : LayoutHandler
{
public new static IPropertyMapper<IStackLayout, StackLayoutHandler> Mapper = (IPropertyMapper<IStackLayout, StackLayoutHandler>)(object)new PropertyMapper<IStackLayout, StackLayoutHandler>((IPropertyMapper[])(object)new IPropertyMapper[1] { (IPropertyMapper)LayoutHandler.Mapper }) { ["Spacing"] = MapSpacing };
public StackLayoutHandler()
: base((IPropertyMapper?)(object)Mapper)
{
}
protected override SkiaLayoutView CreatePlatformView()
{
return new SkiaStackLayout();
}
protected override void ConnectHandler(SkiaLayoutView platformView)
{
if (platformView is SkiaStackLayout skiaStackLayout)
{
ILayout virtualView = ((ViewHandler<ILayout, SkiaLayoutView>)(object)this).VirtualView;
IStackLayout val = (IStackLayout)(object)((virtualView is IStackLayout) ? virtualView : null);
if (val != null)
{
if (((ViewHandler<ILayout, SkiaLayoutView>)(object)this).VirtualView is HorizontalStackLayout)
{
skiaStackLayout.Orientation = StackOrientation.Horizontal;
}
else if (((ViewHandler<ILayout, SkiaLayoutView>)(object)this).VirtualView is VerticalStackLayout || ((ViewHandler<ILayout, SkiaLayoutView>)(object)this).VirtualView is StackLayout)
{
skiaStackLayout.Orientation = StackOrientation.Vertical;
}
skiaStackLayout.Spacing = (float)val.Spacing;
}
}
base.ConnectHandler(platformView);
}
public static void MapSpacing(StackLayoutHandler handler, IStackLayout layout)
{
if (((ViewHandler<ILayout, SkiaLayoutView>)(object)handler).PlatformView is SkiaStackLayout skiaStackLayout)
{
skiaStackLayout.Spacing = (float)layout.Spacing;
}
}
}