]> gitweb.factorcode.org Git - factor.git/blob - basis/windows/surface-dial/surface-dial.factor
scryfall: better moxfield words
[factor.git] / basis / windows / surface-dial / surface-dial.factor
1 ! Copyright (C) 2018 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors alien.c-types alien.data alien.syntax
4 classes.struct kernel multiline namespaces ui windows.com
5 windows.com.syntax windows.com.wrapper windows.ole32
6 windows.types ;
7 IN: windows.surface-dial
8
9 STRUCT: HSTRING__
10     { unused int } ;
11 TYPEDEF: HSTRING__* HSTRING
12
13 ENUM: TrustLevel
14     { BaseTrust 0 }
15     { PartialTrust 1 }
16     { FullTrust 2 } ;
17
18 COM-INTERFACE: IInspectable IUnknown {AF86E2E0-B12D-4c6a-9C5A-D7AA65101E90}
19     HRESULT GetIids ( ULONG* iidCount, IID** iids )
20     HRESULT GetRuntimeClassName ( HSTRING* className )
21     HRESULT GetTrustLevel ( TrustLevel* trustLevel )
22 ;
23
24 ! IInspectable
25 COM-INTERFACE: IRadialControllerConfigurationInterop IInspectable {787cdaac-3186-476d-87e4-b9374a7b9970}
26     HRESULT GetForWindow ( HWND hwnd, REFIID riid, void** ppv )
27 ;
28
29 COM-INTERFACE: IRadialControllerInterop IInspectable {1B0535C9-57AD-45C1-9D79-AD5C34360513}
30     HRESULT CreateForWindow ( HWND hwnd, REFIID riid, void** ppv )
31 ;
32
33 <<
34 SYMBOL: +radial-controller-configuration-wrapper+
35 SYMBOL: +radial-controller-wrapper+
36 >>
37
38 <<
39 {
40     {
41         IRadialControllerConfigurationInterop
42         {
43             ! HRESULT GetIids ( this, ULONG* iidCount, IID** iids )
44             [ 3drop S_OK ]
45
46             ! HRESULT GetRuntimeClassName ( this, HSTRING* className )
47             [ 2drop S_OK ]
48
49             ! HRESULT GetTrustLevel ( this, TrustLevel* trustLevel )
50             [ 2drop S_OK ]
51
52             ! HRESULT GetForWindow ( this, HWND hwnd, REFIID riid, void** ppv )
53             [
54                 4drop S_OK
55             ]
56         }
57     }
58 } <com-wrapper> +radial-controller-configuration-wrapper+ set-global
59 >>
60
61 <<
62 {
63     {
64         IRadialControllerInterop
65         {
66             ! HRESULT GetIids ( this, ULONG* iidCount, IID** iids )
67             [ 3drop S_OK ]
68
69             ! HRESULT GetRuntimeClassName ( this, HSTRING* className )
70             [ 2drop S_OK ]
71
72             ! HRESULT GetTrustLevel ( this, TrustLevel* trustLevel )
73             [ 2drop S_OK ]
74
75             ! HRESULT CreateForWindow ( this, HWND hwnd, REFIID riid, void** ppv )
76             [
77                 4drop S_OK
78             ]
79         }
80     }
81 } <com-wrapper> +radial-controller-wrapper+ set-global
82 >>
83
84 ! Does nothing yet
85 TUPLE: surface-dial ;
86 C: <surface-dial> surface-dial
87
88 : make-radial-controller-configuration ( -- obj )
89     <surface-dial> +radial-controller-configuration-wrapper+ get com-wrap
90     IRadialControllerConfigurationInterop-iid com-query-interface [
91         topmost-window handle>> hWnd>>
92         IRadialControllerConfigurationInterop-iid
93         { void* } [
94             IRadialControllerConfigurationInterop::GetForWindow check-ole32-error
95         ] with-out-parameters
96     ] with-com-interface ;
97
98 : make-radial-controller ( -- obj )
99     <surface-dial> +radial-controller-wrapper+ get com-wrap
100     IRadialControllerInterop-iid com-query-interface [
101         topmost-window handle>> hWnd>>
102         IRadialControllerInterop-iid
103         { void* } [
104             IRadialControllerInterop::CreateForWindow check-ole32-error
105         ] with-out-parameters
106     ] with-com-interface ;