| 1 |
/* |
| 2 |
* Copyright (C) 2023 Biswapriyo Nath |
| 3 |
* |
| 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. |
| 8 |
* |
| 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. |
| 13 |
* |
| 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 |
| 17 |
*/ |
| 18 |
|
| 19 |
import "oaidl.idl"; |
| 20 |
import "ocidl.idl"; |
| 21 |
import "inspectable.idl"; |
| 22 |
import "dxgi1_2.idl"; |
| 23 |
|
| 24 |
cpp_quote("#ifndef E_NOTFOUND") |
| 25 |
cpp_quote("#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)") |
| 26 |
cpp_quote("#endif") |
| 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);") |
| 30 |
|
| 31 |
typedef unsigned hyper InstanceHandle; |
| 32 |
|
| 33 |
typedef enum VisualMutationType |
| 34 |
{ |
| 35 |
Add, |
| 36 |
Remove |
| 37 |
} VisualMutationType; |
| 38 |
|
| 39 |
typedef enum BaseValueSource |
| 40 |
{ |
| 41 |
BaseValueSourceUnknown, |
| 42 |
BaseValueSourceDefault, |
| 43 |
BaseValueSourceBuiltInStyle, |
| 44 |
BaseValueSourceStyle, |
| 45 |
BaseValueSourceLocal, |
| 46 |
Inherited, |
| 47 |
DefaultStyleTrigger, |
| 48 |
TemplateTrigger, |
| 49 |
StyleTrigger, |
| 50 |
ImplicitStyleReference, |
| 51 |
ParentTemplate, |
| 52 |
ParentTemplateTrigger, |
| 53 |
Animation, |
| 54 |
Coercion, |
| 55 |
BaseValueSourceVisualState |
| 56 |
} BaseValueSource; |
| 57 |
|
| 58 |
typedef struct SourceInfo |
| 59 |
{ |
| 60 |
BSTR FileName; |
| 61 |
unsigned int LineNumber; |
| 62 |
unsigned int ColumnNumber; |
| 63 |
unsigned int CharPosition; |
| 64 |
BSTR Hash; |
| 65 |
} SourceInfo; |
| 66 |
|
| 67 |
typedef struct ParentChildRelation |
| 68 |
{ |
| 69 |
InstanceHandle Parent; |
| 70 |
InstanceHandle Child; |
| 71 |
unsigned int ChildIndex; |
| 72 |
} ParentChildRelation; |
| 73 |
|
| 74 |
typedef struct VisualElement |
| 75 |
{ |
| 76 |
InstanceHandle Handle; |
| 77 |
SourceInfo SrcInfo; |
| 78 |
BSTR Type; |
| 79 |
BSTR Name; |
| 80 |
unsigned int NumChildren; |
| 81 |
} VisualElement; |
| 82 |
|
| 83 |
typedef struct PropertyChainSource |
| 84 |
{ |
| 85 |
InstanceHandle Handle; |
| 86 |
BSTR TargetType; |
| 87 |
BSTR Name; |
| 88 |
BaseValueSource Source; |
| 89 |
SourceInfo SrcInfo; |
| 90 |
} PropertyChainSource; |
| 91 |
|
| 92 |
typedef enum MetadataBit |
| 93 |
{ |
| 94 |
None = 0x0, |
| 95 |
IsValueHandle = 0x1, |
| 96 |
IsPropertyReadOnly = 0x2, |
| 97 |
IsValueCollection = 0x4, |
| 98 |
IsValueCollectionReadOnly = 0x8, |
| 99 |
IsValueBindingExpression = 0x10, |
| 100 |
IsValueNull = 0x20, |
| 101 |
IsValueHandleAndEvaluatedValue = 0x40, |
| 102 |
} MetadataBit; |
| 103 |
|
| 104 |
typedef struct PropertyChainValue |
| 105 |
{ |
| 106 |
unsigned int Index; |
| 107 |
BSTR Type; |
| 108 |
BSTR DeclaringType; |
| 109 |
BSTR ValueType; |
| 110 |
BSTR ItemType; |
| 111 |
BSTR Value; |
| 112 |
BOOL Overridden; |
| 113 |
hyper MetadataBits; |
| 114 |
BSTR PropertyName; |
| 115 |
unsigned int PropertyChainIndex; |
| 116 |
} PropertyChainValue; |
| 117 |
|
| 118 |
typedef struct EnumType |
| 119 |
{ |
| 120 |
BSTR Name; |
| 121 |
SAFEARRAY(int) ValueInts; |
| 122 |
SAFEARRAY(BSTR) ValueStrings; |
| 123 |
} EnumType; |
| 124 |
|
| 125 |
typedef struct CollectionElementValue |
| 126 |
{ |
| 127 |
unsigned int Index; |
| 128 |
BSTR ValueType; |
| 129 |
BSTR Value; |
| 130 |
hyper MetadataBits; |
| 131 |
} CollectionElementValue; |
| 132 |
|
| 133 |
typedef enum RenderTargetBitmapOptions |
| 134 |
{ |
| 135 |
RenderTarget, |
| 136 |
RenderTargetAndChildren |
| 137 |
} RenderTargetBitmapOptions; |
| 138 |
|
| 139 |
typedef struct BitmapDescription |
| 140 |
{ |
| 141 |
unsigned int Width; |
| 142 |
unsigned int Height; |
| 143 |
DXGI_FORMAT Format; |
| 144 |
DXGI_ALPHA_MODE AlphaMode; |
| 145 |
} BitmapDescription; |
| 146 |
|
| 147 |
typedef enum ResourceType |
| 148 |
{ |
| 149 |
ResourceTypeStatic, |
| 150 |
ResourceTypeTheme |
| 151 |
} ResourceType; |
| 152 |
|
| 153 |
typedef enum VisualElementState |
| 154 |
{ |
| 155 |
ErrorResolved, |
| 156 |
ErrorResourceNotFound, |
| 157 |
ErrorInvalidResource, |
| 158 |
} VisualElementState; |
| 159 |
|
| 160 |
[ |
| 161 |
object, |
| 162 |
uuid(aa7a8931-80e4-4fec-8f3b-553f87b4966e) |
| 163 |
] |
| 164 |
interface IVisualTreeServiceCallback : IUnknown |
| 165 |
{ |
| 166 |
HRESULT OnVisualTreeChange( |
| 167 |
[in] ParentChildRelation relation, |
| 168 |
[in] VisualElement element, |
| 169 |
[in] VisualMutationType mutation_type); |
| 170 |
} |
| 171 |
|
| 172 |
[ |
| 173 |
object, |
| 174 |
uuid(bad9eb88-ae77-4397-b948-5fa2db0a19ea) |
| 175 |
] |
| 176 |
interface IVisualTreeServiceCallback2 : IVisualTreeServiceCallback |
| 177 |
{ |
| 178 |
HRESULT OnElementStateChanged( |
| 179 |
[in] InstanceHandle element, |
| 180 |
[in] VisualElementState element_state, |
| 181 |
[in] LPCWSTR context); |
| 182 |
} |
| 183 |
|
| 184 |
[ |
| 185 |
object, |
| 186 |
uuid(a593b11a-d17f-48bb-8f66-83910731c8a5) |
| 187 |
] |
| 188 |
interface IVisualTreeService : IUnknown |
| 189 |
{ |
| 190 |
HRESULT AdviseVisualTreeChange([in] IVisualTreeServiceCallback *callback); |
| 191 |
|
| 192 |
HRESULT UnadviseVisualTreeChange([in] IVisualTreeServiceCallback *callback); |
| 193 |
|
| 194 |
HRESULT GetEnums( |
| 195 |
[out] unsigned int *count, |
| 196 |
[out, size_is(, *count)] EnumType **enums); |
| 197 |
|
| 198 |
HRESULT CreateInstance( |
| 199 |
[in] BSTR type_name, |
| 200 |
[in] BSTR value, |
| 201 |
[out, retval] InstanceHandle *instance_handle); |
| 202 |
|
| 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); |
| 209 |
|
| 210 |
HRESULT SetProperty( |
| 211 |
[in] InstanceHandle instance_handle, |
| 212 |
[in] InstanceHandle value, |
| 213 |
[in] unsigned int property_index); |
| 214 |
|
| 215 |
HRESULT ClearProperty( |
| 216 |
[in] InstanceHandle instance_handle, |
| 217 |
[in] unsigned int property_index); |
| 218 |
|
| 219 |
HRESULT GetCollectionCount( |
| 220 |
[in] InstanceHandle instance_handle, |
| 221 |
[out] unsigned int *collection_size); |
| 222 |
|
| 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); |
| 228 |
|
| 229 |
HRESULT AddChild( |
| 230 |
[in] InstanceHandle parent, |
| 231 |
[in] InstanceHandle child, |
| 232 |
[in] unsigned int index); |
| 233 |
|
| 234 |
HRESULT RemoveChild( |
| 235 |
[in] InstanceHandle parent, |
| 236 |
[in] unsigned int index); |
| 237 |
|
| 238 |
HRESULT ClearChildren([in] InstanceHandle parent); |
| 239 |
} |
| 240 |
|
| 241 |
[ |
| 242 |
object, |
| 243 |
uuid(18c9e2b6-3f43-4116-9f2b-ff935d7770d2) |
| 244 |
] |
| 245 |
interface IXamlDiagnostics : IUnknown |
| 246 |
{ |
| 247 |
HRESULT GetDispatcher([out, retval] IInspectable **dispatcher); |
| 248 |
|
| 249 |
HRESULT GetUiLayer([out, retval] IInspectable **layer); |
| 250 |
|
| 251 |
HRESULT GetApplication([out, retval] IInspectable **application); |
| 252 |
|
| 253 |
HRESULT GetIInspectableFromHandle( |
| 254 |
[in] InstanceHandle instance_handle, |
| 255 |
[out, retval] IInspectable **instance); |
| 256 |
|
| 257 |
HRESULT GetHandleFromIInspectable( |
| 258 |
[in] IInspectable *instance, |
| 259 |
[out, retval] InstanceHandle *handle); |
| 260 |
|
| 261 |
HRESULT HitTest( |
| 262 |
[in] RECT rect, |
| 263 |
[out] unsigned int *count, |
| 264 |
[out, size_is(, *count)] InstanceHandle **instance_handles); |
| 265 |
|
| 266 |
HRESULT RegisterInstance( |
| 267 |
[in] IInspectable *instance, |
| 268 |
[out, retval] InstanceHandle *instance_handle); |
| 269 |
|
| 270 |
HRESULT GetInitializationData([out, retval] BSTR *initialization_data); |
| 271 |
} |
| 272 |
|
| 273 |
[ |
| 274 |
object, |
| 275 |
uuid(d1a34ef2-cad8-4635-a3d2-fcda8d3f3caf) |
| 276 |
] |
| 277 |
interface IBitmapData : IUnknown |
| 278 |
{ |
| 279 |
HRESULT CopyBytesTo( |
| 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); |
| 284 |
|
| 285 |
HRESULT GetStride([out] unsigned int *stride); |
| 286 |
|
| 287 |
HRESULT GetBitmapDescription([out] BitmapDescription *bitmap_description); |
| 288 |
|
| 289 |
HRESULT GetSourceBitmapDescription([out] BitmapDescription *bitmap_description); |
| 290 |
} |
| 291 |
|
| 292 |
[ |
| 293 |
object, |
| 294 |
uuid(130f5136-ec43-4f61-89c7-9801a36d2e95) |
| 295 |
] |
| 296 |
interface IVisualTreeService2 : IVisualTreeService |
| 297 |
{ |
| 298 |
HRESULT GetPropertyIndex( |
| 299 |
[in] InstanceHandle object, |
| 300 |
[in] LPCWSTR property_name, |
| 301 |
[out] unsigned int *property_index); |
| 302 |
|
| 303 |
HRESULT GetProperty( |
| 304 |
[in] InstanceHandle object, |
| 305 |
[in] unsigned int property_index, |
| 306 |
[out] InstanceHandle *value); |
| 307 |
|
| 308 |
HRESULT ReplaceResource( |
| 309 |
[in] InstanceHandle resource_dictionary, |
| 310 |
[in] InstanceHandle key, |
| 311 |
[in] InstanceHandle new_value); |
| 312 |
|
| 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); |
| 319 |
} |
| 320 |
|
| 321 |
[ |
| 322 |
object, |
| 323 |
uuid(0e79c6e0-85a0-4be8-b41a-655cf1fd19bd) |
| 324 |
] |
| 325 |
interface IVisualTreeService3 : IVisualTreeService2 |
| 326 |
{ |
| 327 |
HRESULT ResolveResource( |
| 328 |
[in] InstanceHandle resource_context, |
| 329 |
[in] LPCWSTR resource_name, |
| 330 |
[in] ResourceType resource_type, |
| 331 |
[in] unsigned int property_index); |
| 332 |
|
| 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); |
| 338 |
|
| 339 |
HRESULT AddDictionaryItem( |
| 340 |
[in] InstanceHandle dictionary_handle, |
| 341 |
[in] InstanceHandle resource_key, |
| 342 |
[in] InstanceHandle resource_handle); |
| 343 |
|
| 344 |
HRESULT RemoveDictionaryItem( |
| 345 |
[in] InstanceHandle dictionary_handle, |
| 346 |
[in] InstanceHandle resource_key); |
| 347 |
} |