From dc52e28f2fcfda0d73beaf97f6f641473b574288 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 17 Mar 2018 18:34:23 -0500 Subject: [PATCH] windows.surface-dial: Add surface-dial COM interface. --- basis/windows/surface-dial/authors.txt | 1 + basis/windows/surface-dial/platforms.txt | 1 + .../windows/surface-dial/surface-dial.factor | 106 ++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 basis/windows/surface-dial/authors.txt create mode 100644 basis/windows/surface-dial/platforms.txt create mode 100644 basis/windows/surface-dial/surface-dial.factor diff --git a/basis/windows/surface-dial/authors.txt b/basis/windows/surface-dial/authors.txt new file mode 100644 index 0000000000..7c1b2f2279 --- /dev/null +++ b/basis/windows/surface-dial/authors.txt @@ -0,0 +1 @@ +Doug Coleman diff --git a/basis/windows/surface-dial/platforms.txt b/basis/windows/surface-dial/platforms.txt new file mode 100644 index 0000000000..d493d3459b --- /dev/null +++ b/basis/windows/surface-dial/platforms.txt @@ -0,0 +1 @@ +windows \ No newline at end of file diff --git a/basis/windows/surface-dial/surface-dial.factor b/basis/windows/surface-dial/surface-dial.factor new file mode 100644 index 0000000000..36ee5814e0 --- /dev/null +++ b/basis/windows/surface-dial/surface-dial.factor @@ -0,0 +1,106 @@ +! Copyright (C) 2018 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors alien.c-types alien.data alien.syntax +classes.struct kernel multiline namespaces ui windows.com +windows.com.syntax windows.com.wrapper windows.ole32 +windows.types ; +IN: windows.surface-dial + +STRUCT: HSTRING__ + { unused int } ; +TYPEDEF: HSTRING__* HSTRING + +ENUM: TrustLevel + { BaseTrust 0 } + { PartialTrust 1 } + { FullTrust 2 } ; + +COM-INTERFACE: IInspectable IUnknown {AF86E2E0-B12D-4c6a-9C5A-D7AA65101E90} + HRESULT GetIids ( ULONG* iidCount, IID** iids ) + HRESULT GetRuntimeClassName ( HSTRING* className ) + HRESULT GetTrustLevel ( TrustLevel* trustLevel ) +; + +! IInspectable +COM-INTERFACE: IRadialControllerConfigurationInterop IInspectable {787cdaac-3186-476d-87e4-b9374a7b9970} + HRESULT GetForWindow ( HWND hwnd, REFIID riid, void** ppv ) +; + +COM-INTERFACE: IRadialControllerInterop IInspectable {1B0535C9-57AD-45C1-9D79-AD5C34360513} + HRESULT CreateForWindow ( HWND hwnd, REFIID riid, void** ppv ) +; + +<< +SYMBOL: +radial-controller-configuration-wrapper+ +SYMBOL: +radial-controller-wrapper+ +>> + +<< +{ + { + IRadialControllerConfigurationInterop + { + ! HRESULT GetIids ( this, ULONG* iidCount, IID** iids ) + [ 3drop S_OK ] + + ! HRESULT GetRuntimeClassName ( this, HSTRING* className ) + [ 2drop S_OK ] + + ! HRESULT GetTrustLevel ( this, TrustLevel* trustLevel ) + [ 2drop S_OK ] + + ! HRESULT GetForWindow ( this, HWND hwnd, REFIID riid, void** ppv ) + [ + 4drop S_OK + ] + } + } +} +radial-controller-configuration-wrapper+ set-global +>> + +<< +{ + { + IRadialControllerInterop + { + ! HRESULT GetIids ( this, ULONG* iidCount, IID** iids ) + [ 3drop S_OK ] + + ! HRESULT GetRuntimeClassName ( this, HSTRING* className ) + [ 2drop S_OK ] + + ! HRESULT GetTrustLevel ( this, TrustLevel* trustLevel ) + [ 2drop S_OK ] + + ! HRESULT CreateForWindow ( this, HWND hwnd, REFIID riid, void** ppv ) + [ + 4drop S_OK + ] + } + } +} +radial-controller-wrapper+ set-global +>> + +! Does nothing yet +TUPLE: surface-dial ; +C: surface-dial + +: make-radial-controller-configuration ( -- obj ) + +radial-controller-configuration-wrapper+ get com-wrap + IRadialControllerConfigurationInterop-iid com-query-interface [ + topmost-window handle>> hWnd>> + IRadialControllerConfigurationInterop-iid + { void* } [ + IRadialControllerConfigurationInterop::GetForWindow check-ole32-error + ] with-out-parameters + ] with-com-interface ; + +: make-radial-controller ( -- obj ) + +radial-controller-wrapper+ get com-wrap + IRadialControllerInterop-iid com-query-interface [ + topmost-window handle>> hWnd>> + IRadialControllerInterop-iid + { void* } [ + IRadialControllerInterop::CreateForWindow check-ole32-error + ] with-out-parameters + ] with-com-interface ; -- 2.34.1