swift-winui/Sources/WinUI/Generated/Microsoft.UI.Xaml.Data+Impl.swift
2024-02-15 17:16:00 -08:00

96 lines
4.4 KiB
Swift

// WARNING: Please don't edit this file. It was generated by Swift/WinRT v0.0.1
// swiftlint:disable all
import Foundation
@_spi(WinRTInternal) @_spi(WinRTImplements) import WindowsFoundation
import CWinRT
public enum __IMPL_Microsoft_UI_Xaml_Data {
public enum INotifyPropertyChangedBridge : AbiInterfaceBridge {
public typealias CABI = __x_ABI_CMicrosoft_CUI_CXaml_CData_CINotifyPropertyChanged
public typealias SwiftABI = __ABI_Microsoft_UI_Xaml_Data.INotifyPropertyChanged
public typealias SwiftProjection = AnyINotifyPropertyChanged
public static func from(abi: ComPtr<CABI>?) -> SwiftProjection? {
guard let abi = abi else { return nil }
return INotifyPropertyChangedImpl(abi)
}
public static func makeAbi() -> CABI {
let vtblPtr = withUnsafeMutablePointer(to: &__ABI_Microsoft_UI_Xaml_Data.INotifyPropertyChangedVTable) { $0 }
return .init(lpVtbl: vtblPtr)
}
}
fileprivate class INotifyPropertyChangedImpl: INotifyPropertyChanged, WinRTAbiImpl {
fileprivate typealias Bridge = INotifyPropertyChangedBridge
fileprivate let _default: Bridge.SwiftABI
fileprivate var thisPtr: WindowsFoundation.IInspectable { _default }
fileprivate init(_ fromAbi: ComPtr<Bridge.CABI>) {
_default = Bridge.SwiftABI(fromAbi)
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.data.inotifypropertychanged.propertychanged)
fileprivate lazy var propertyChanged : Event<PropertyChangedEventHandler> = {
.init(
add: { [weak self] in
guard let this = self?._default else { return .init() }
return try! this.add_PropertyChangedImpl($0)
},
remove: { [weak self] in
try? self?._default.remove_PropertyChangedImpl($0)
}
)
}()
}
public enum IValueConverterBridge : AbiInterfaceBridge {
public typealias CABI = __x_ABI_CMicrosoft_CUI_CXaml_CData_CIValueConverter
public typealias SwiftABI = __ABI_Microsoft_UI_Xaml_Data.IValueConverter
public typealias SwiftProjection = AnyIValueConverter
public static func from(abi: ComPtr<CABI>?) -> SwiftProjection? {
guard let abi = abi else { return nil }
return IValueConverterImpl(abi)
}
public static func makeAbi() -> CABI {
let vtblPtr = withUnsafeMutablePointer(to: &__ABI_Microsoft_UI_Xaml_Data.IValueConverterVTable) { $0 }
return .init(lpVtbl: vtblPtr)
}
}
fileprivate class IValueConverterImpl: IValueConverter, WinRTAbiImpl {
fileprivate typealias Bridge = IValueConverterBridge
fileprivate let _default: Bridge.SwiftABI
fileprivate var thisPtr: WindowsFoundation.IInspectable { _default }
fileprivate init(_ fromAbi: ComPtr<Bridge.CABI>) {
_default = Bridge.SwiftABI(fromAbi)
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.data.ivalueconverter.convert)
fileprivate func convert(_ value: Any!, _ targetType: WinUI.TypeName, _ parameter: Any!, _ language: String) throws -> Any! {
try _default.ConvertImpl(value, targetType, parameter, language)
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.data.ivalueconverter.convertback)
fileprivate func convertBack(_ value: Any!, _ targetType: WinUI.TypeName, _ parameter: Any!, _ language: String) throws -> Any! {
try _default.ConvertBackImpl(value, targetType, parameter, language)
}
}
public class PropertyChangedEventHandlerBridge : WinRTDelegateBridge {
public typealias Handler = PropertyChangedEventHandler
public typealias CABI = __x_ABI_CMicrosoft_CUI_CXaml_CData_CIPropertyChangedEventHandler
public typealias SwiftABI = __ABI_Microsoft_UI_Xaml_Data.PropertyChangedEventHandler
public static func from(abi: ComPtr<CABI>?) -> Handler? {
guard let abi = abi else { return nil }
let _default = SwiftABI(abi)
let handler: Handler = { (sender, e) in
try! _default.InvokeImpl(sender, e)
}
return handler
}
}
}