From: Biswapriyo Nath nathbappai@gmail.com
--- include/Makefile.in | 1 + include/xamlom.idl | 345 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 346 insertions(+) create mode 100644 include/xamlom.idl
diff --git a/include/Makefile.in b/include/Makefile.in index 0dae4cab2bf..acbfeadf389 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -970,6 +970,7 @@ SOURCES = \ xact2wb.h \ xact3.h \ xact3wb.h \ + xamlom.idl \ xapo.idl \ xapofx.h \ xaudio2.idl \ diff --git a/include/xamlom.idl b/include/xamlom.idl new file mode 100644 index 00000000000..35ca8711fe6 --- /dev/null +++ b/include/xamlom.idl @@ -0,0 +1,345 @@ +/* + * Copyright (C) 2023 Biswapriyo Nath + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +import "oaidl.idl"; +import "ocidl.idl"; +import "inspectable.idl"; +import "dxgi1_2.idl"; + +cpp_quote("#define E_NOTFOUND _HRESULT_TYPEDEF_(0x80070490)") +cpp_quote("#define E_UNKNOWNTYPE _HRESULT_TYPEDEF_(0x802b0028)") +cpp_quote("HRESULT WINAPI InitializeXamlDiagnostic(PCWSTR, DWORD, PCWSTR, PCWSTR, CLSID);") +cpp_quote("HRESULT WINAPI InitializeXamlDiagnosticsEx(PCWSTR, DWORD, PCWSTR, PCWSTR, CLSID, PCWSTR);") + +typedef unsigned hyper InstanceHandle; + +typedef enum VisualMutationType +{ + Add = 0, + Remove +} VisualMutationType; + +typedef enum BaseValueSource +{ + BaseValueSourceUnknown = 0, + BaseValueSourceDefault, + BaseValueSourceBuiltInStyle, + BaseValueSourceStyle, + BaseValueSourceLocal, + Inherited, + DefaultStyleTrigger, + TemplateTrigger, + StyleTrigger, + ImplicitStyleReference, + ParentTemplate, + ParentTemplateTrigger, + Animation, + Coercion, + BaseValueSourceVisualState +} BaseValueSource; + +typedef struct SourceInfo +{ + BSTR FileName; + unsigned int LineNumber; + unsigned int ColumnNumber; + unsigned int CharPosition; + BSTR Hash; +} SourceInfo; + +typedef struct ParentChildRelation +{ + InstanceHandle Parent; + InstanceHandle Child; + unsigned int ChildIndex; +} ParentChildRelation; + +typedef struct VisualElement +{ + InstanceHandle Handle; + SourceInfo SrcInfo; + BSTR Type; + BSTR Name; + unsigned int NumChildren; +} VisualElement; + +typedef struct PropertyChainSource +{ + InstanceHandle Handle; + BSTR TargetType; + BSTR Name; + BaseValueSource Source; + SourceInfo SrcInfo; +} PropertyChainSource; + +typedef enum MetadataBit +{ + None = 0x0, + IsValueHandle = 0x1, + IsPropertyReadOnly = 0x2, + IsValueCollection = 0x4, + IsValueCollectionReadOnly = 0x8, + IsValueBindingExpression = 0x10, + IsValueNull = 0x20, + IsValueHandleAndEvaluatedValue = 0x40, +} MetadataBit; + +typedef struct PropertyChainValue +{ + unsigned int Index; + BSTR Type; + BSTR DeclaringType; + BSTR ValueType; + BSTR ItemType; + BSTR Value; + BOOL Overridden; + hyper MetadataBits; + BSTR PropertyName; + unsigned int PropertyChainIndex; +} PropertyChainValue; + +typedef struct EnumType +{ + BSTR Name; + SAFEARRAY(int) ValueInts; + SAFEARRAY(BSTR) ValueStrings; +} EnumType; + +typedef struct CollectionElementValue +{ + unsigned int Index; + BSTR ValueType; + BSTR Value; + hyper MetadataBits; +} CollectionElementValue; + +typedef enum RenderTargetBitmapOptions +{ + RenderTarget = 0, + RenderTargetAndChildren +} RenderTargetBitmapOptions; + +typedef struct BitmapDescription +{ + unsigned int Width; + unsigned int Height; + DXGI_FORMAT Format; + DXGI_ALPHA_MODE AlphaMode; +} BitmapDescription; + +typedef enum ResourceType +{ + ResourceTypeStatic = 0, + ResourceTypeTheme +} ResourceType; + +typedef enum VisualElementState +{ + ErrorResolved = 0, + ErrorResourceNotFound, + ErrorInvalidResource, +} VisualElementState; + +[ + object, + uuid(aa7a8931-80e4-4fec-8f3b-553f87b4966e) +] +interface IVisualTreeServiceCallback : IUnknown +{ + HRESULT OnVisualTreeChange( + [in] ParentChildRelation relation, + [in] VisualElement element, + [in] VisualMutationType mutationType); +} + +[ + object, + uuid(bad9eb88-ae77-4397-b948-5fa2db0a19ea) +] +interface IVisualTreeServiceCallback2 : IVisualTreeServiceCallback +{ + HRESULT OnElementStateChanged( + [in] InstanceHandle element, + [in] VisualElementState elementState, + [in] LPCWSTR context); +} + +[ + object, + uuid(a593b11a-d17f-48bb-8f66-83910731c8a5) +] +interface IVisualTreeService : IUnknown +{ + HRESULT AdviseVisualTreeChange([in] IVisualTreeServiceCallback *pCallback); + + HRESULT UnadviseVisualTreeChange([in] IVisualTreeServiceCallback *pCallback); + + HRESULT GetEnums( + [out] unsigned int* pCount, + [out, size_is(, *pCount)] EnumType** ppEnums); + + HRESULT CreateInstance( + [in] BSTR typeName, + [in] BSTR value, + [out, retval] InstanceHandle* pInstanceHandle); + + HRESULT GetPropertyValuesChain( + [in] InstanceHandle instanceHandle, + [out] unsigned int* pSourceCount, + [out, size_is(, *pSourceCount)] PropertyChainSource** ppPropertySources, + [out] unsigned int* pPropertyCount, + [out, size_is(, *pPropertyCount)] PropertyChainValue** ppPropertyValues); + + HRESULT SetProperty( + [in] InstanceHandle instanceHandle, + [in] InstanceHandle value, + [in] unsigned int propertyIndex); + + HRESULT ClearProperty( + [in] InstanceHandle instanceHandle, + [in] unsigned int propertyIndex); + + HRESULT GetCollectionCount( + [in] InstanceHandle instanceHandle, + [out] unsigned int* pCollectionSize); + + HRESULT GetCollectionElements( + [in] InstanceHandle instanceHandle, + [in] unsigned int startIndex, + [in, out] unsigned int* pElementCount, + [out, size_is(, *pElementCount)] CollectionElementValue** ppElementValues); + + HRESULT AddChild( + [in] InstanceHandle parent, + [in] InstanceHandle child, + [in] unsigned int index); + + HRESULT RemoveChild( + [in] InstanceHandle parent, + [in] unsigned int index); + + HRESULT ClearChildren([in] InstanceHandle parent); +} + +[ + object, + uuid(18c9e2b6-3f43-4116-9f2b-ff935d7770d2) +] +interface IXamlDiagnostics : IUnknown +{ + HRESULT GetDispatcher([out, retval] IInspectable** ppDispatcher); + + HRESULT GetUiLayer([out, retval] IInspectable** ppLayer); + + HRESULT GetApplication([out, retval] IInspectable** ppApplication); + + HRESULT GetIInspectableFromHandle( + [in] InstanceHandle instanceHandle, + [out, retval] IInspectable** ppInstance); + + HRESULT GetHandleFromIInspectable( + [in] IInspectable* pInstance, + [out, retval] InstanceHandle* pHandle); + + HRESULT HitTest( + [in] RECT rect, + [out] unsigned int* pCount, + [out, size_is(, *pCount)] InstanceHandle** ppInstanceHandles); + + HRESULT RegisterInstance( + [in] IInspectable* pInstance, + [out, retval] InstanceHandle *pInstanceHandle); + + HRESULT GetInitializationData([out, retval] BSTR* pInitializationData); +} + +[ + object, + uuid(d1a34ef2-cad8-4635-a3d2-fcda8d3f3caf) +] +interface IBitmapData : IUnknown +{ + HRESULT CopyBytesTo( + [in] unsigned int sourceOffsetInBytes, + [in] unsigned int maxBytesToCopy, + [out, size_is(maxBytesToCopy)] byte* pvBytes, + [out] unsigned int* numberOfBytesCopied); + + HRESULT GetStride([out] unsigned int* pStride); + + HRESULT GetBitmapDescription([out] BitmapDescription* pBitmapDescription); + + HRESULT GetSourceBitmapDescription([out] BitmapDescription* pBitmapDescription); +} + +[ + object, + uuid(130f5136-ec43-4f61-89c7-9801a36d2e95) +] +interface IVisualTreeService2 : IVisualTreeService +{ + HRESULT GetPropertyIndex( + [in] InstanceHandle object, + [in] LPCWSTR propertyName, + [out] unsigned int* pPropertyIndex); + + HRESULT GetProperty( + [in] InstanceHandle object, + [in] unsigned int propertyIndex, + [out] InstanceHandle* pValue); + + HRESULT ReplaceResource( + [in] InstanceHandle resourceDictionary, + [in] InstanceHandle key, + [in] InstanceHandle newValue); + + HRESULT RenderTargetBitmap( + [in] InstanceHandle handle, + [in] RenderTargetBitmapOptions options, + [in] unsigned int maxPixelWidth, + [in] unsigned int maxPixelHeight, + [out] IBitmapData** ppBitmapData); +} + +[ + object, + uuid(0e79c6e0-85a0-4be8-b41a-655cf1fd19bd) +] +interface IVisualTreeService3 : IVisualTreeService2 +{ + HRESULT ResolveResource( + [in] InstanceHandle resourceContext, + [in] LPCWSTR resourceName, + [in] ResourceType resourceType, + [in] unsigned int propertyIndex); + + HRESULT GetDictionaryItem( + [in] InstanceHandle dictionaryHandle, + [in] LPCWSTR resourceName, + [in] BOOL resourceIsImplicitStyle, + [out] InstanceHandle* resourceHandle); + + HRESULT AddDictionaryItem( + [in] InstanceHandle dictionaryHandle, + [in] InstanceHandle resourceKey, + [in] InstanceHandle resourceHandle); + + HRESULT RemoveDictionaryItem( + [in] InstanceHandle dictionaryHandle, + [in] InstanceHandle resourceKey); +}