2 * Copyright (C) 2023 Biswapriyo Nath
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 import
"inspectable.idl";
24 cpp_quote
("#ifndef E_NOTFOUND")
25 cpp_quote
("#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)")
27 cpp_quote
("#define E_UNKNOWNTYPE _HRESULT_TYPEDEF_(0x802b0028)")
28 cpp_quote
("HRESULT WINAPI InitializeXamlDiagnostic(PCWSTR, DWORD, PCWSTR, PCWSTR, CLSID);")
29 cpp_quote
("HRESULT WINAPI InitializeXamlDiagnosticsEx(PCWSTR, DWORD, PCWSTR, PCWSTR, CLSID, PCWSTR);")
31 typedef unsigned hyper InstanceHandle
;
33 typedef enum VisualMutationType
39 typedef enum BaseValueSource
41 BaseValueSourceUnknown
,
42 BaseValueSourceDefault
,
43 BaseValueSourceBuiltInStyle
,
50 ImplicitStyleReference
,
52 ParentTemplateTrigger
,
55 BaseValueSourceVisualState
58 typedef struct SourceInfo
61 unsigned int LineNumber
;
62 unsigned int ColumnNumber
;
63 unsigned int CharPosition
;
67 typedef struct ParentChildRelation
69 InstanceHandle Parent
;
71 unsigned int ChildIndex
;
72 } ParentChildRelation
;
74 typedef struct VisualElement
76 InstanceHandle
Handle;
80 unsigned int NumChildren
;
83 typedef struct PropertyChainSource
85 InstanceHandle
Handle;
88 BaseValueSource
Source;
90 } PropertyChainSource
;
92 typedef enum MetadataBit
96 IsPropertyReadOnly
= 0x2,
97 IsValueCollection
= 0x4,
98 IsValueCollectionReadOnly
= 0x8,
99 IsValueBindingExpression
= 0x10,
101 IsValueHandleAndEvaluatedValue
= 0x40,
104 typedef struct PropertyChainValue
115 unsigned int PropertyChainIndex
;
116 } PropertyChainValue
;
118 typedef struct EnumType
121 SAFEARRAY(int) ValueInts
;
122 SAFEARRAY(BSTR) ValueStrings
;
125 typedef struct CollectionElementValue
131 } CollectionElementValue
;
133 typedef enum RenderTargetBitmapOptions
136 RenderTargetAndChildren
137 } RenderTargetBitmapOptions
;
139 typedef struct BitmapDescription
144 DXGI_ALPHA_MODE AlphaMode
;
147 typedef enum ResourceType
153 typedef enum VisualElementState
156 ErrorResourceNotFound
,
157 ErrorInvalidResource
,
158 } VisualElementState
;
162 uuid(aa7a8931
-80e4
-4fec
-8f3b
-553f87b4966e
)
164 interface IVisualTreeServiceCallback
: IUnknown
166 HRESULT OnVisualTreeChange
(
167 [in] ParentChildRelation relation
,
168 [in] VisualElement element
,
169 [in] VisualMutationType mutation_type
);
174 uuid(bad9eb88
-ae77
-4397-b948
-5fa2db0a19ea
)
176 interface IVisualTreeServiceCallback2
: IVisualTreeServiceCallback
178 HRESULT OnElementStateChanged
(
179 [in] InstanceHandle element
,
180 [in] VisualElementState element_state
,
181 [in] LPCWSTR context
);
186 uuid(a593b11a
-d17f
-48bb
-8f66
-83910731c8a5
)
188 interface IVisualTreeService
: IUnknown
190 HRESULT AdviseVisualTreeChange
([in] IVisualTreeServiceCallback
*callback);
192 HRESULT UnadviseVisualTreeChange
([in] IVisualTreeServiceCallback
*callback);
195 [out] unsigned int *count
,
196 [out, size_is(, *count
)] EnumType
**enums
);
198 HRESULT CreateInstance
(
201 [out, retval] InstanceHandle
*instance_handle
);
203 HRESULT GetPropertyValuesChain
(
204 [in] InstanceHandle instance_handle
,
205 [out] unsigned int *source_count
,
206 [out, size_is(, *source_count
)] PropertyChainSource
**property_sources
,
207 [out] unsigned int *property_count
,
208 [out, size_is(, *property_count
)] PropertyChainValue
**property_values
);
211 [in] InstanceHandle instance_handle
,
212 [in] InstanceHandle value
,
213 [in] unsigned int property_index
);
215 HRESULT ClearProperty
(
216 [in] InstanceHandle instance_handle
,
217 [in] unsigned int property_index
);
219 HRESULT GetCollectionCount
(
220 [in] InstanceHandle instance_handle
,
221 [out] unsigned int *collection_size
);
223 HRESULT GetCollectionElements
(
224 [in] InstanceHandle instance_handle
,
225 [in] unsigned int start_index
,
226 [in, out] unsigned int *element_count
,
227 [out, size_is(, *element_count
)] CollectionElementValue
**element_values
);
230 [in] InstanceHandle parent
,
231 [in] InstanceHandle child
,
232 [in] unsigned int index
);
235 [in] InstanceHandle parent
,
236 [in] unsigned int index
);
238 HRESULT ClearChildren
([in] InstanceHandle parent
);
243 uuid(18c9e2b6
-3f43
-4116-9f2b
-ff935d7770d2
)
245 interface IXamlDiagnostics
: IUnknown
247 HRESULT GetDispatcher
([out, retval] IInspectable
**dispatcher
);
249 HRESULT GetUiLayer
([out, retval] IInspectable
**layer
);
251 HRESULT GetApplication
([out, retval] IInspectable
**application
);
253 HRESULT GetIInspectableFromHandle
(
254 [in] InstanceHandle instance_handle
,
255 [out, retval] IInspectable
**instance
);
257 HRESULT GetHandleFromIInspectable
(
258 [in] IInspectable
*instance
,
259 [out, retval] InstanceHandle
*handle);
263 [out] unsigned int *count
,
264 [out, size_is(, *count
)] InstanceHandle
**instance_handles
);
266 HRESULT RegisterInstance
(
267 [in] IInspectable
*instance
,
268 [out, retval] InstanceHandle
*instance_handle
);
270 HRESULT GetInitializationData
([out, retval] BSTR *initialization_data
);
275 uuid(d1a34ef2
-cad8
-4635-a3d2
-fcda8d3f3caf
)
277 interface IBitmapData
: IUnknown
280 [in] unsigned int source_offset_in_bytes
,
281 [in] unsigned int max_bytes_to_copy
,
282 [out, size_is(max_bytes_to_copy
)] byte *bytes
,
283 [out] unsigned int *number_of_bytes_copied
);
285 HRESULT GetStride
([out] unsigned int *stride
);
287 HRESULT GetBitmapDescription
([out] BitmapDescription
*bitmap_description
);
289 HRESULT GetSourceBitmapDescription
([out] BitmapDescription
*bitmap_description
);
294 uuid(130f5136
-ec43
-4f61
-89c7
-9801a36d2e95
)
296 interface IVisualTreeService2
: IVisualTreeService
298 HRESULT GetPropertyIndex
(
299 [in] InstanceHandle
object,
300 [in] LPCWSTR property_name
,
301 [out] unsigned int *property_index
);
304 [in] InstanceHandle
object,
305 [in] unsigned int property_index
,
306 [out] InstanceHandle
*value
);
308 HRESULT ReplaceResource
(
309 [in] InstanceHandle resource_dictionary
,
310 [in] InstanceHandle key
,
311 [in] InstanceHandle new_value
);
313 HRESULT RenderTargetBitmap
(
314 [in] InstanceHandle
handle,
315 [in] RenderTargetBitmapOptions options
,
316 [in] unsigned int max_pixel_width
,
317 [in] unsigned int max_pixel_height
,
318 [out] IBitmapData
**bitmap_data
);
323 uuid(0e79c6e0
-85a0
-4be8
-b41a
-655cf1fd19bd
)
325 interface IVisualTreeService3
: IVisualTreeService2
327 HRESULT ResolveResource
(
328 [in] InstanceHandle resource_context
,
329 [in] LPCWSTR resource_name
,
330 [in] ResourceType resource_type
,
331 [in] unsigned int property_index
);
333 HRESULT GetDictionaryItem
(
334 [in] InstanceHandle dictionary_handle
,
335 [in] LPCWSTR resource_name
,
336 [in] BOOL resource_is_implicit_style
,
337 [out] InstanceHandle
*resource_handle
);
339 HRESULT AddDictionaryItem
(
340 [in] InstanceHandle dictionary_handle
,
341 [in] InstanceHandle resource_key
,
342 [in] InstanceHandle resource_handle
);
344 HRESULT RemoveDictionaryItem
(
345 [in] InstanceHandle dictionary_handle
,
346 [in] InstanceHandle resource_key
);