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
This commit is contained in:
2026-01-01 06:22:48 -05:00
parent 1e84c6168a
commit 1f096c38dc
254 changed files with 49359 additions and 38457 deletions

View File

@@ -1,106 +1,111 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.Maui.Handlers;
using Microsoft.Maui.Graphics;
using System;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Platform;
using SkiaSharp;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Handlers;
namespace Microsoft.Maui.Platform.Linux.Handlers;
/// <summary>
/// Handler for RadioButton on Linux using Skia rendering.
/// </summary>
public partial class RadioButtonHandler : ViewHandler<IRadioButton, SkiaRadioButton>
public class RadioButtonHandler : ViewHandler<IRadioButton, SkiaRadioButton>
{
public static IPropertyMapper<IRadioButton, RadioButtonHandler> Mapper =
new PropertyMapper<IRadioButton, RadioButtonHandler>(ViewHandler.ViewMapper)
{
[nameof(IRadioButton.IsChecked)] = MapIsChecked,
[nameof(ITextStyle.TextColor)] = MapTextColor,
[nameof(ITextStyle.Font)] = MapFont,
[nameof(IView.Background)] = MapBackground,
};
public static IPropertyMapper<IRadioButton, RadioButtonHandler> Mapper = (IPropertyMapper<IRadioButton, RadioButtonHandler>)(object)new PropertyMapper<IRadioButton, RadioButtonHandler>((IPropertyMapper[])(object)new IPropertyMapper[1] { (IPropertyMapper)ViewHandler.ViewMapper })
{
["IsChecked"] = MapIsChecked,
["TextColor"] = MapTextColor,
["Font"] = MapFont,
["Background"] = MapBackground
};
public static CommandMapper<IRadioButton, RadioButtonHandler> CommandMapper =
new(ViewHandler.ViewCommandMapper)
{
};
public static CommandMapper<IRadioButton, RadioButtonHandler> CommandMapper = new CommandMapper<IRadioButton, RadioButtonHandler>((CommandMapper)(object)ViewHandler.ViewCommandMapper);
public RadioButtonHandler() : base(Mapper, CommandMapper)
{
}
public RadioButtonHandler()
: base((IPropertyMapper)(object)Mapper, (CommandMapper)(object)CommandMapper)
{
}
public RadioButtonHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null)
: base(mapper ?? Mapper, commandMapper ?? CommandMapper)
{
}
public RadioButtonHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null)
: base((IPropertyMapper)(((object)mapper) ?? ((object)Mapper)), (CommandMapper)(((object)commandMapper) ?? ((object)CommandMapper)))
{
}
protected override SkiaRadioButton CreatePlatformView()
{
return new SkiaRadioButton();
}
protected override SkiaRadioButton CreatePlatformView()
{
return new SkiaRadioButton();
}
protected override void ConnectHandler(SkiaRadioButton platformView)
{
base.ConnectHandler(platformView);
platformView.CheckedChanged += OnCheckedChanged;
protected override void ConnectHandler(SkiaRadioButton platformView)
{
base.ConnectHandler(platformView);
platformView.CheckedChanged += OnCheckedChanged;
IRadioButton virtualView = base.VirtualView;
RadioButton val = (RadioButton)(object)((virtualView is RadioButton) ? virtualView : null);
if (val != null)
{
platformView.Content = val.Content?.ToString() ?? "";
platformView.GroupName = val.GroupName;
platformView.Value = val.Value;
}
}
// Set content if available
if (VirtualView is RadioButton rb)
{
platformView.Content = rb.Content?.ToString() ?? "";
platformView.GroupName = rb.GroupName;
platformView.Value = rb.Value;
}
}
protected override void DisconnectHandler(SkiaRadioButton platformView)
{
platformView.CheckedChanged -= OnCheckedChanged;
base.DisconnectHandler(platformView);
}
protected override void DisconnectHandler(SkiaRadioButton platformView)
{
platformView.CheckedChanged -= OnCheckedChanged;
base.DisconnectHandler(platformView);
}
private void OnCheckedChanged(object? sender, EventArgs e)
{
if (base.VirtualView != null && base.PlatformView != null)
{
base.VirtualView.IsChecked = base.PlatformView.IsChecked;
}
}
private void OnCheckedChanged(object? sender, EventArgs e)
{
if (VirtualView is null || PlatformView is null) return;
VirtualView.IsChecked = PlatformView.IsChecked;
}
public static void MapIsChecked(RadioButtonHandler handler, IRadioButton radioButton)
{
if (((ViewHandler<IRadioButton, SkiaRadioButton>)(object)handler).PlatformView != null)
{
((ViewHandler<IRadioButton, SkiaRadioButton>)(object)handler).PlatformView.IsChecked = radioButton.IsChecked;
}
}
public static void MapIsChecked(RadioButtonHandler handler, IRadioButton radioButton)
{
if (handler.PlatformView is null) return;
handler.PlatformView.IsChecked = radioButton.IsChecked;
}
public static void MapTextColor(RadioButtonHandler handler, IRadioButton radioButton)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (((ViewHandler<IRadioButton, SkiaRadioButton>)(object)handler).PlatformView != null && ((ITextStyle)radioButton).TextColor != null)
{
((ViewHandler<IRadioButton, SkiaRadioButton>)(object)handler).PlatformView.TextColor = ((ITextStyle)radioButton).TextColor.ToSKColor();
}
}
public static void MapTextColor(RadioButtonHandler handler, IRadioButton radioButton)
{
if (handler.PlatformView is null) return;
public static void MapFont(RadioButtonHandler handler, IRadioButton radioButton)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
if (((ViewHandler<IRadioButton, SkiaRadioButton>)(object)handler).PlatformView != null)
{
Font font = ((ITextStyle)radioButton).Font;
if (((Font)(ref font)).Size > 0.0)
{
SkiaRadioButton platformView = ((ViewHandler<IRadioButton, SkiaRadioButton>)(object)handler).PlatformView;
font = ((ITextStyle)radioButton).Font;
platformView.FontSize = (float)((Font)(ref font)).Size;
}
}
}
if (radioButton.TextColor is not null)
{
handler.PlatformView.TextColor = radioButton.TextColor.ToSKColor();
}
}
public static void MapFont(RadioButtonHandler handler, IRadioButton radioButton)
{
if (handler.PlatformView is null) return;
if (radioButton.Font.Size > 0)
{
handler.PlatformView.FontSize = (float)radioButton.Font.Size;
}
}
public static void MapBackground(RadioButtonHandler handler, IRadioButton radioButton)
{
if (handler.PlatformView is null) return;
if (radioButton.Background is SolidPaint solidPaint && solidPaint.Color is not null)
{
handler.PlatformView.BackgroundColor = solidPaint.Color.ToSKColor();
}
}
public static void MapBackground(RadioButtonHandler handler, IRadioButton radioButton)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
if (((ViewHandler<IRadioButton, SkiaRadioButton>)(object)handler).PlatformView != null)
{
Paint background = ((IView)radioButton).Background;
SolidPaint val = (SolidPaint)(object)((background is SolidPaint) ? background : null);
if (val != null && val.Color != null)
{
((ViewHandler<IRadioButton, SkiaRadioButton>)(object)handler).PlatformView.BackgroundColor = val.Color.ToSKColor();
}
}
}
}