swift-windowsappsdk/Sources/WinAppSDK/Microsoft.UI.Dispatching.swift
2024-02-13 23:50:08 -08:00

367 lines
17 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
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuepriority)
public typealias DispatcherQueuePriority = __x_ABI_CMicrosoft_CUI_CDispatching_CDispatcherQueuePriority
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherrunoptions)
public typealias DispatcherRunOptions = __x_ABI_CMicrosoft_CUI_CDispatching_CDispatcherRunOptions
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherexitdeferral)
public final class DispatcherExitDeferral : WinRTClass {
private typealias SwiftABI = __ABI_Microsoft_UI_Dispatching.IDispatcherExitDeferral
private typealias CABI = __x_ABI_CMicrosoft_CUI_CDispatching_CIDispatcherExitDeferral
private lazy var _default: SwiftABI! = getInterfaceForCaching()
@_spi(WinRTInternal)
override public func _getABI<T>() -> UnsafeMutablePointer<T>? {
if T.self == CABI.self {
return RawPointer(_default)
}
return super._getABI()
}
@_spi(WinRTInternal)
public static func from(abi: ComPtr<__x_ABI_CMicrosoft_CUI_CDispatching_CIDispatcherExitDeferral>?) -> DispatcherExitDeferral? {
guard let abi = abi else { return nil }
return .init(fromAbi: WindowsFoundation.IInspectable(abi))
}
@_spi(WinRTInternal)
public init(fromAbi: WindowsFoundation.IInspectable) {
super.init(fromAbi)
}
override public init() {
super.init(try! RoActivateInstance(HString("Microsoft.UI.Dispatching.DispatcherExitDeferral")))
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherexitdeferral.complete)
public func complete() throws {
try _default.CompleteImpl()
}
deinit {
_default = nil
}
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue)
public final class DispatcherQueue : WinRTClass {
private typealias SwiftABI = __ABI_Microsoft_UI_Dispatching.IDispatcherQueue
private typealias CABI = __x_ABI_CMicrosoft_CUI_CDispatching_CIDispatcherQueue
private lazy var _default: SwiftABI! = getInterfaceForCaching()
@_spi(WinRTInternal)
override public func _getABI<T>() -> UnsafeMutablePointer<T>? {
if T.self == CABI.self {
return RawPointer(_default)
}
return super._getABI()
}
@_spi(WinRTInternal)
public static func from(abi: ComPtr<__x_ABI_CMicrosoft_CUI_CDispatching_CIDispatcherQueue>?) -> DispatcherQueue? {
guard let abi = abi else { return nil }
return .init(fromAbi: WindowsFoundation.IInspectable(abi))
}
@_spi(WinRTInternal)
public init(fromAbi: WindowsFoundation.IInspectable) {
super.init(fromAbi)
}
private static let _IDispatcherQueueStatics: __ABI_Microsoft_UI_Dispatching.IDispatcherQueueStatics = try! RoGetActivationFactory(HString("Microsoft.UI.Dispatching.DispatcherQueue"))
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue.getforcurrentthread)
public static func getForCurrentThread() -> DispatcherQueue! {
return try! _IDispatcherQueueStatics.GetForCurrentThreadImpl()
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue.createtimer)
public func createTimer() throws -> DispatcherQueueTimer! {
try _default.CreateTimerImpl()
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue.tryenqueue)
public func tryEnqueue(_ callback: DispatcherQueueHandler!) throws -> Bool {
try _default.TryEnqueueImpl(callback)
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue.tryenqueue)
public func tryEnqueue(_ priority: DispatcherQueuePriority, _ callback: DispatcherQueueHandler!) throws -> Bool {
try _default.TryEnqueueWithPriorityImpl(priority, callback)
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue.shutdowncompleted)
public lazy var shutdownCompleted : Event<TypedEventHandler<DispatcherQueue?, Any?>> = {
.init(
add: { [weak self] in
guard let this = self?._default else { return .init() }
return try! this.add_ShutdownCompletedImpl($0)
},
remove: { [weak self] in
try? self?._default.remove_ShutdownCompletedImpl($0)
}
)
}()
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue.shutdownstarting)
public lazy var shutdownStarting : Event<TypedEventHandler<DispatcherQueue?, DispatcherQueueShutdownStartingEventArgs?>> = {
.init(
add: { [weak self] in
guard let this = self?._default else { return .init() }
return try! this.add_ShutdownStartingImpl($0)
},
remove: { [weak self] in
try? self?._default.remove_ShutdownStartingImpl($0)
}
)
}()
private lazy var _IDispatcherQueue2: __ABI_Microsoft_UI_Dispatching.IDispatcherQueue2! = getInterfaceForCaching()
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue.hasthreadaccess)
public var hasThreadAccess : Bool {
get { try! _IDispatcherQueue2.get_HasThreadAccessImpl() }
}
private lazy var _IDispatcherQueue3: __ABI_Microsoft_UI_Dispatching.IDispatcherQueue3! = getInterfaceForCaching()
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue.enqueueeventloopexit)
public func enqueueEventLoopExit() throws {
try _IDispatcherQueue3.EnqueueEventLoopExitImpl()
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue.ensuresystemdispatcherqueue)
public func ensureSystemDispatcherQueue() throws {
try _IDispatcherQueue3.EnsureSystemDispatcherQueueImpl()
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue.runeventloop)
public func runEventLoop() throws {
try _IDispatcherQueue3.RunEventLoopImpl()
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue.runeventloop)
public func runEventLoop(_ options: DispatcherRunOptions, _ deferral: DispatcherExitDeferral!) throws {
try _IDispatcherQueue3.RunEventLoopWithOptionsImpl(options, deferral)
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue.frameworkshutdowncompleted)
public lazy var frameworkShutdownCompleted : Event<TypedEventHandler<DispatcherQueue?, Any?>> = {
.init(
add: { [weak self] in
guard let this = self?._IDispatcherQueue3 else { return .init() }
return try! this.add_FrameworkShutdownCompletedImpl($0)
},
remove: { [weak self] in
try? self?._IDispatcherQueue3.remove_FrameworkShutdownCompletedImpl($0)
}
)
}()
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue.frameworkshutdownstarting)
public lazy var frameworkShutdownStarting : Event<TypedEventHandler<DispatcherQueue?, DispatcherQueueShutdownStartingEventArgs?>> = {
.init(
add: { [weak self] in
guard let this = self?._IDispatcherQueue3 else { return .init() }
return try! this.add_FrameworkShutdownStartingImpl($0)
},
remove: { [weak self] in
try? self?._IDispatcherQueue3.remove_FrameworkShutdownStartingImpl($0)
}
)
}()
deinit {
_default = nil
_IDispatcherQueue2 = nil
_IDispatcherQueue3 = nil
}
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuecontroller)
public final class DispatcherQueueController : WinRTClass {
private typealias SwiftABI = __ABI_Microsoft_UI_Dispatching.IDispatcherQueueController
private typealias CABI = __x_ABI_CMicrosoft_CUI_CDispatching_CIDispatcherQueueController
private lazy var _default: SwiftABI! = getInterfaceForCaching()
@_spi(WinRTInternal)
override public func _getABI<T>() -> UnsafeMutablePointer<T>? {
if T.self == CABI.self {
return RawPointer(_default)
}
return super._getABI()
}
@_spi(WinRTInternal)
public static func from(abi: ComPtr<__x_ABI_CMicrosoft_CUI_CDispatching_CIDispatcherQueueController>?) -> DispatcherQueueController? {
guard let abi = abi else { return nil }
return .init(fromAbi: WindowsFoundation.IInspectable(abi))
}
@_spi(WinRTInternal)
public init(fromAbi: WindowsFoundation.IInspectable) {
super.init(fromAbi)
}
private static let _IDispatcherQueueControllerStatics: __ABI_Microsoft_UI_Dispatching.IDispatcherQueueControllerStatics = try! RoGetActivationFactory(HString("Microsoft.UI.Dispatching.DispatcherQueueController"))
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuecontroller.createondedicatedthread)
public static func createOnDedicatedThread() -> DispatcherQueueController! {
return try! _IDispatcherQueueControllerStatics.CreateOnDedicatedThreadImpl()
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuecontroller.createoncurrentthread)
public static func createOnCurrentThread() -> DispatcherQueueController! {
return try! _IDispatcherQueueControllerStatics.CreateOnCurrentThreadImpl()
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuecontroller.shutdownqueueasync)
public func shutdownQueueAsync() throws -> WindowsFoundation.AnyIAsyncAction! {
try _default.ShutdownQueueAsyncImpl()
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuecontroller.dispatcherqueue)
public var dispatcherQueue : DispatcherQueue! {
get { try! _default.get_DispatcherQueueImpl() }
}
private lazy var _IDispatcherQueueController2: __ABI_Microsoft_UI_Dispatching.IDispatcherQueueController2! = getInterfaceForCaching()
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuecontroller.shutdownqueue)
public func shutdownQueue() throws {
try _IDispatcherQueueController2.ShutdownQueueImpl()
}
deinit {
_default = nil
_IDispatcherQueueController2 = nil
}
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueueshutdownstartingeventargs)
public final class DispatcherQueueShutdownStartingEventArgs : WinRTClass {
private typealias SwiftABI = __ABI_Microsoft_UI_Dispatching.IDispatcherQueueShutdownStartingEventArgs
private typealias CABI = __x_ABI_CMicrosoft_CUI_CDispatching_CIDispatcherQueueShutdownStartingEventArgs
private lazy var _default: SwiftABI! = getInterfaceForCaching()
@_spi(WinRTInternal)
override public func _getABI<T>() -> UnsafeMutablePointer<T>? {
if T.self == CABI.self {
return RawPointer(_default)
}
return super._getABI()
}
@_spi(WinRTInternal)
public static func from(abi: ComPtr<__x_ABI_CMicrosoft_CUI_CDispatching_CIDispatcherQueueShutdownStartingEventArgs>?) -> DispatcherQueueShutdownStartingEventArgs? {
guard let abi = abi else { return nil }
return .init(fromAbi: WindowsFoundation.IInspectable(abi))
}
@_spi(WinRTInternal)
public init(fromAbi: WindowsFoundation.IInspectable) {
super.init(fromAbi)
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueueshutdownstartingeventargs.getdeferral)
public func getDeferral() throws -> WindowsFoundation.Deferral! {
try _default.GetDeferralImpl()
}
deinit {
_default = nil
}
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuetimer)
public final class DispatcherQueueTimer : WinRTClass {
private typealias SwiftABI = __ABI_Microsoft_UI_Dispatching.IDispatcherQueueTimer
private typealias CABI = __x_ABI_CMicrosoft_CUI_CDispatching_CIDispatcherQueueTimer
private lazy var _default: SwiftABI! = getInterfaceForCaching()
@_spi(WinRTInternal)
override public func _getABI<T>() -> UnsafeMutablePointer<T>? {
if T.self == CABI.self {
return RawPointer(_default)
}
return super._getABI()
}
@_spi(WinRTInternal)
public static func from(abi: ComPtr<__x_ABI_CMicrosoft_CUI_CDispatching_CIDispatcherQueueTimer>?) -> DispatcherQueueTimer? {
guard let abi = abi else { return nil }
return .init(fromAbi: WindowsFoundation.IInspectable(abi))
}
@_spi(WinRTInternal)
public init(fromAbi: WindowsFoundation.IInspectable) {
super.init(fromAbi)
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuetimer.start)
public func start() throws {
try _default.StartImpl()
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuetimer.stop)
public func stop() throws {
try _default.StopImpl()
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuetimer.interval)
public var interval : WindowsFoundation.TimeSpan {
get { try! _default.get_IntervalImpl() }
set { try! _default.put_IntervalImpl(newValue) }
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuetimer.isrepeating)
public var isRepeating : Bool {
get { try! _default.get_IsRepeatingImpl() }
set { try! _default.put_IsRepeatingImpl(newValue) }
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuetimer.isrunning)
public var isRunning : Bool {
get { try! _default.get_IsRunningImpl() }
}
/// [Open Microsoft documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueuetimer.tick)
public lazy var tick : Event<TypedEventHandler<DispatcherQueueTimer?, Any?>> = {
.init(
add: { [weak self] in
guard let this = self?._default else { return .init() }
return try! this.add_TickImpl($0)
},
remove: { [weak self] in
try? self?._default.remove_TickImpl($0)
}
)
}()
deinit {
_default = nil
}
}
public typealias DispatcherQueueHandler = () -> ()
extension WinAppSDK.DispatcherQueuePriority {
public static var low : WinAppSDK.DispatcherQueuePriority {
__x_ABI_CMicrosoft_CUI_CDispatching_CDispatcherQueuePriority_Low
}
public static var normal : WinAppSDK.DispatcherQueuePriority {
__x_ABI_CMicrosoft_CUI_CDispatching_CDispatcherQueuePriority_Normal
}
public static var high : WinAppSDK.DispatcherQueuePriority {
__x_ABI_CMicrosoft_CUI_CDispatching_CDispatcherQueuePriority_High
}
}
extension WinAppSDK.DispatcherQueuePriority: @retroactive Hashable, @retroactive Codable {}
extension WinAppSDK.DispatcherRunOptions {
public static var none : WinAppSDK.DispatcherRunOptions {
__x_ABI_CMicrosoft_CUI_CDispatching_CDispatcherRunOptions_None
}
public static var continueOnQuit : WinAppSDK.DispatcherRunOptions {
__x_ABI_CMicrosoft_CUI_CDispatching_CDispatcherRunOptions_ContinueOnQuit
}
public static var quitOnlyLocalLoop : WinAppSDK.DispatcherRunOptions {
__x_ABI_CMicrosoft_CUI_CDispatching_CDispatcherRunOptions_QuitOnlyLocalLoop
}
}
extension WinAppSDK.DispatcherRunOptions: @retroactive Hashable, @retroactive Codable {}