Skip to content

Commit

Permalink
Update IDLs to work for both versions of Xaml
Browse files Browse the repository at this point in the history
  • Loading branch information
krschau committed Jun 7, 2023
1 parent 16e7b2e commit 1d5826f
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 57 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#ifdef USE_WINUI3

#define Xaml_OM WinUI3

#else // !USE_WINUI3

import "Windows.Foundation.idl";
import "Windows.Data.Json.idl";

namespace AdaptiveCards.ObjectModel.Uwp
#define Xaml_OM Uwp

#endif // USE_WINUI3

namespace AdaptiveCards.ObjectModel.Xaml_OM
{
runtimeclass AdaptiveCardParseResult;

Expand Down
127 changes: 71 additions & 56 deletions source/uwp/SharedRenderer/idl/AdaptiveCards.Rendering.Shared.idl
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#ifdef USE_WINUI3

#define Xaml_OM WinUI3
#define xaml Microsoft.UI.Xaml

#else // !USE_WINUI3

#define Xaml_OM Uwp
#define xaml Windows.UI.Xaml

import "Windows.Foundation.idl";
import "Windows.Data.Json.idl";

import "inspectable.idl";
import "Windows.Foundation.idl";
import "Windows.UI.Xaml.idl";
import "Windows.Data.Json.idl";
import "AdaptiveCards.ObjectModel.Uwp.idl";
import "AdaptiveCards.ObjectModel.Shared.idl";

#endif // USE_WINUI3

namespace AdaptiveCards
{
namespace Rendering
{
namespace Uwp
namespace Xaml_OM
{
runtimeclass AdaptiveHostConfigParseResult;

Expand Down Expand Up @@ -47,7 +62,7 @@ namespace AdaptiveCards

AdaptiveCardResourceResolvers ResourceResolvers { get; };
AdaptiveHostConfig HostConfig;
Windows.UI.Xaml.ResourceDictionary OverrideStyles;
xaml.ResourceDictionary OverrideStyles;
AdaptiveFeatureRegistration FeatureRegistration;

Boolean OverflowMaxActions;
Expand All @@ -57,7 +72,7 @@ namespace AdaptiveCards
void SetFixedDimensions(UInt32 desiredWidth, UInt32 desiredHeight);
void ResetFixedDimensions();

RenderedAdaptiveCard RenderAdaptiveCard(AdaptiveCards.ObjectModel.Uwp.AdaptiveCard adaptiveCard);
RenderedAdaptiveCard RenderAdaptiveCard(AdaptiveCards.ObjectModel.Xaml_OM.AdaptiveCard adaptiveCard);
RenderedAdaptiveCard RenderAdaptiveCardFromJsonString(String adaptiveCard);
RenderedAdaptiveCard RenderAdaptiveCardFromJson(Windows.Data.Json.JsonObject adaptiveCard);

Expand All @@ -67,13 +82,13 @@ namespace AdaptiveCards

runtimeclass AdaptiveActionEventArgs
{
AdaptiveCards.ObjectModel.Uwp.IAdaptiveActionElement Action { get; };
AdaptiveCards.ObjectModel.Xaml_OM.IAdaptiveActionElement Action { get; };
AdaptiveInputs Inputs { get; };
}

runtimeclass AdaptiveMediaEventArgs
{
AdaptiveCards.ObjectModel.Uwp.AdaptiveMedia Media { get; };
AdaptiveCards.ObjectModel.Xaml_OM.AdaptiveMedia Media { get; };
}

runtimeclass AdaptiveContainerStyleDefinition
Expand Down Expand Up @@ -166,11 +181,11 @@ namespace AdaptiveCards

interface IAdaptiveTextStyleConfig
{
AdaptiveCards.ObjectModel.Uwp.TextWeight Weight;
AdaptiveCards.ObjectModel.Uwp.TextSize Size;
AdaptiveCards.ObjectModel.Uwp.ForegroundColor Color;
AdaptiveCards.ObjectModel.Xaml_OM.TextWeight Weight;
AdaptiveCards.ObjectModel.Xaml_OM.TextSize Size;
AdaptiveCards.ObjectModel.Xaml_OM.ForegroundColor Color;
Boolean IsSubtle;
AdaptiveCards.ObjectModel.Uwp.FontType FontType;
AdaptiveCards.ObjectModel.Xaml_OM.FontType FontType;
}

runtimeclass AdaptiveTextStyleConfig : [default] IAdaptiveTextStyleConfig { AdaptiveTextStyleConfig(); }
Expand Down Expand Up @@ -224,15 +239,15 @@ namespace AdaptiveCards
{
AdaptiveImageSetConfig();

AdaptiveCards.ObjectModel.Uwp.ImageSize ImageSize;
AdaptiveCards.ObjectModel.Xaml_OM.ImageSize ImageSize;
UInt32 MaxImageHeight;
}

runtimeclass AdaptiveImageConfig
{
AdaptiveImageConfig();

AdaptiveCards.ObjectModel.Uwp.ImageSize ImageSize;
AdaptiveCards.ObjectModel.Xaml_OM.ImageSize ImageSize;
}

runtimeclass AdaptiveCardConfig
Expand All @@ -256,7 +271,7 @@ namespace AdaptiveCards
AdaptiveShowCardActionConfig();

ActionMode ActionMode;
AdaptiveCards.ObjectModel.Uwp.ContainerStyle Style;
AdaptiveCards.ObjectModel.Xaml_OM.ContainerStyle Style;
UInt32 InlineTopMargin;
}

Expand All @@ -269,7 +284,7 @@ namespace AdaptiveCards
ActionAlignment ActionAlignment;
UInt32 ButtonSpacing;
UInt32 MaxActions;
AdaptiveCards.ObjectModel.Uwp.Spacing Spacing;
AdaptiveCards.ObjectModel.Xaml_OM.Spacing Spacing;
IconPlacement IconPlacement;
UInt32 IconSize;
}
Expand All @@ -287,18 +302,18 @@ namespace AdaptiveCards
{
AdaptiveInputLabelConfig();

AdaptiveCards.ObjectModel.Uwp.ForegroundColor Color;
AdaptiveCards.ObjectModel.Xaml_OM.ForegroundColor Color;
Boolean IsSubtle;
AdaptiveCards.ObjectModel.Uwp.TextSize Size;
AdaptiveCards.ObjectModel.Xaml_OM.TextSize Size;
String Suffix;
AdaptiveCards.ObjectModel.Uwp.TextWeight Weight;
AdaptiveCards.ObjectModel.Xaml_OM.TextWeight Weight;
}

runtimeclass AdaptiveLabelConfig
{
AdaptiveLabelConfig();

AdaptiveCards.ObjectModel.Uwp.Spacing InputSpacing;
AdaptiveCards.ObjectModel.Xaml_OM.Spacing InputSpacing;

AdaptiveInputLabelConfig RequiredInputs;
AdaptiveInputLabelConfig OptionalInputs;
Expand All @@ -308,9 +323,9 @@ namespace AdaptiveCards
{
AdaptiveErrorMessageConfig();

AdaptiveCards.ObjectModel.Uwp.TextSize Size;
AdaptiveCards.ObjectModel.Uwp.Spacing Spacing;
AdaptiveCards.ObjectModel.Uwp.TextWeight Weight;
AdaptiveCards.ObjectModel.Xaml_OM.TextSize Size;
AdaptiveCards.ObjectModel.Xaml_OM.Spacing Spacing;
AdaptiveCards.ObjectModel.Xaml_OM.TextWeight Weight;
}

runtimeclass AdaptiveInputsConfig
Expand Down Expand Up @@ -369,7 +384,7 @@ namespace AdaptiveCards
AdaptiveHostConfigParseResult();

AdaptiveHostConfig HostConfig { get; };
Windows.Foundation.Collections.IVector<AdaptiveCards.ObjectModel.Uwp.AdaptiveError> Errors { get; };
Windows.Foundation.Collections.IVector<AdaptiveCards.ObjectModel.Xaml_OM.AdaptiveError> Errors { get; };
}

runtimeclass AdaptiveCardResourceResolvers
Expand Down Expand Up @@ -400,12 +415,12 @@ namespace AdaptiveCards
{
RenderedAdaptiveCard();

AdaptiveCards.ObjectModel.Uwp.AdaptiveCard OriginatingCard { get; };
AdaptiveCards.ObjectModel.Xaml_OM.AdaptiveCard OriginatingCard { get; };
AdaptiveHostConfig OriginatingHostConfig { get; };
Windows.UI.Xaml.FrameworkElement FrameworkElement { get; };
xaml.FrameworkElement FrameworkElement { get; };
AdaptiveInputs UserInputs { get; };
Windows.Foundation.Collections.IVector<AdaptiveCards.ObjectModel.Uwp.AdaptiveError> Errors { get; };
Windows.Foundation.Collections.IVector<AdaptiveCards.ObjectModel.Uwp.AdaptiveWarning> Warnings { get; };
Windows.Foundation.Collections.IVector<AdaptiveCards.ObjectModel.Xaml_OM.AdaptiveError> Errors { get; };
Windows.Foundation.Collections.IVector<AdaptiveCards.ObjectModel.Xaml_OM.AdaptiveWarning> Warnings { get; };

event Windows.Foundation.TypedEventHandler<RenderedAdaptiveCard, AdaptiveActionEventArgs> Action;
event Windows.Foundation.TypedEventHandler<RenderedAdaptiveCard, AdaptiveMediaEventArgs> MediaClicked;
Expand All @@ -418,7 +433,7 @@ namespace AdaptiveCards
Windows.Data.Json.JsonObject AsJson();
Windows.Foundation.Collections.ValueSet AsValueSet();

Boolean ValidateInputs(AdaptiveCards.ObjectModel.Uwp.IAdaptiveActionElement submitAction);
Boolean ValidateInputs(AdaptiveCards.ObjectModel.Xaml_OM.IAdaptiveActionElement submitAction);
}

runtimeclass AdaptiveFeatureRegistration
Expand Down Expand Up @@ -451,35 +466,35 @@ namespace AdaptiveCards
AdaptiveActionInvoker();
AdaptiveActionInvoker(RenderedAdaptiveCard renderResult);

void SendActionEvent(AdaptiveCards.ObjectModel.Uwp.IAdaptiveActionElement actionElement);
void SendActionEvent(AdaptiveCards.ObjectModel.Xaml_OM.IAdaptiveActionElement actionElement);
}

runtimeclass AdaptiveMediaEventInvoker
{
AdaptiveMediaEventInvoker();
AdaptiveMediaEventInvoker(RenderedAdaptiveCard renderResult);

void SendMediaClickedEvent(AdaptiveCards.ObjectModel.Uwp.AdaptiveMedia mediaElement);
void SendMediaClickedEvent(AdaptiveCards.ObjectModel.Xaml_OM.AdaptiveMedia mediaElement);
}

runtimeclass AdaptiveRenderArgs
{
AdaptiveRenderArgs();

AdaptiveCards.ObjectModel.Uwp.ContainerStyle ContainerStyle;
AdaptiveCards.ObjectModel.Xaml_OM.ContainerStyle ContainerStyle;
IInspectable ParentElement;
Boolean IsInShowCard;
Boolean AllowAboveTitleIconPlacement;
Boolean AncestorHasFallback;
Boolean AddContainerPadding;
AdaptiveCards.ObjectModel.Uwp.AdaptiveCard ParentCard;
AdaptiveCards.ObjectModel.Xaml_OM.AdaptiveCard ParentCard;
}

interface IAdaptiveInputValue
{
AdaptiveCards.ObjectModel.Uwp.IAdaptiveInputElement InputElement { get; };
AdaptiveCards.ObjectModel.Xaml_OM.IAdaptiveInputElement InputElement { get; };
String CurrentValue { get; };
Windows.UI.Xaml.UIElement ErrorMessage
xaml.UIElement ErrorMessage
{
get;
set;
Expand All @@ -499,34 +514,34 @@ namespace AdaptiveCards
AdaptiveCardResourceResolvers ResourceResolvers { get; };
AdaptiveActionInvoker ActionInvoker { get; };
AdaptiveMediaEventInvoker MediaEventInvoker { get; };
Windows.UI.Xaml.ResourceDictionary OverrideStyles { get; };
xaml.ResourceDictionary OverrideStyles { get; };
AdaptiveInputs UserInputs { get; };
Windows.Foundation.IReference<Boolean> Rtl;
Windows.Foundation.IReference<AdaptiveCards.ObjectModel.Uwp.TextStyle> TextStyle;
Windows.Foundation.IReference<AdaptiveCards.ObjectModel.Uwp.HAlignment> HorizontalContentAlignment;
Windows.Foundation.IReference<AdaptiveCards.ObjectModel.Xaml_OM.TextStyle> TextStyle;
Windows.Foundation.IReference<AdaptiveCards.ObjectModel.Xaml_OM.HAlignment> HorizontalContentAlignment;

void AddInputValue(IAdaptiveInputValue inputValue, AdaptiveRenderArgs renderArgs);
void LinkSubmitActionToCard(AdaptiveCards.ObjectModel.Uwp.IAdaptiveActionElement submitAction,
void LinkSubmitActionToCard(AdaptiveCards.ObjectModel.Xaml_OM.IAdaptiveActionElement submitAction,
AdaptiveRenderArgs renderArgs);
void LinkCardToParent(AdaptiveCards.ObjectModel.Uwp.AdaptiveCard card, AdaptiveRenderArgs renderArgs);
IAdaptiveInputValue GetInputValue(AdaptiveCards.ObjectModel.Uwp.IAdaptiveInputElement inputElement);
void LinkCardToParent(AdaptiveCards.ObjectModel.Xaml_OM.AdaptiveCard card, AdaptiveRenderArgs renderArgs);
IAdaptiveInputValue GetInputValue(AdaptiveCards.ObjectModel.Xaml_OM.IAdaptiveInputElement inputElement);

void AddError(AdaptiveCards.ObjectModel.Uwp.ErrorStatusCode statusCode, String message);
void AddWarning(AdaptiveCards.ObjectModel.Uwp.WarningStatusCode statusCode, String message);
void AddError(AdaptiveCards.ObjectModel.Xaml_OM.ErrorStatusCode statusCode, String message);
void AddWarning(AdaptiveCards.ObjectModel.Xaml_OM.WarningStatusCode statusCode, String message);
}

interface IAdaptiveElementRenderer
{
Windows.UI.Xaml.UIElement Render(AdaptiveCards.ObjectModel.Uwp.IAdaptiveCardElement element,
AdaptiveRenderContext context,
AdaptiveRenderArgs renderArgs);
xaml.UIElement Render(AdaptiveCards.ObjectModel.Xaml_OM.IAdaptiveCardElement element,
AdaptiveRenderContext context,
AdaptiveRenderArgs renderArgs);
}

interface IAdaptiveActionRenderer
{
Windows.UI.Xaml.UIElement Render(AdaptiveCards.ObjectModel.Uwp.IAdaptiveActionElement element,
AdaptiveRenderContext context,
AdaptiveRenderArgs renderArgs);
xaml.UIElement Render(AdaptiveCards.ObjectModel.Xaml_OM.IAdaptiveActionElement element,
AdaptiveRenderContext context,
AdaptiveRenderArgs renderArgs);
}

[default_interface] runtimeclass AdaptiveTableRenderer : IAdaptiveElementRenderer
Expand Down Expand Up @@ -639,17 +654,17 @@ namespace AdaptiveCards
AdaptiveToggleVisibilityActionRenderer();
}

runtimeclass TileControl : Windows.UI.Xaml.Controls.ContentControl
runtimeclass TileControl : xaml.Controls.ContentControl
{
TileControl();

Windows.UI.Xaml.UIElement ResolvedImage { get; };
AdaptiveCards.ObjectModel.Uwp.AdaptiveBackgroundImage BackgroundImage;
xaml.UIElement ResolvedImage { get; };
AdaptiveCards.ObjectModel.Xaml_OM.AdaptiveBackgroundImage BackgroundImage;
Windows.Foundation.Size ImageSize;
void LoadImageBrush(Windows.UI.Xaml.UIElement uielement);
void LoadImageBrush(xaml.UIElement uielement);
}

runtimeclass WholeItemsPanel : Windows.UI.Xaml.Controls.Panel
runtimeclass WholeItemsPanel : xaml.Controls.Panel
{
WholeItemsPanel();

Expand All @@ -662,10 +677,10 @@ namespace AdaptiveCards
{
ElementTagContent();

Windows.UI.Xaml.Controls.ColumnDefinition ColumnDefinition { get; };
AdaptiveCards.ObjectModel.Uwp.IAdaptiveCardElement CardElement { get; };
Windows.UI.Xaml.UIElement Separator { get; };
Windows.UI.Xaml.Controls.Panel ParentPanel { get; };
xaml.Controls.ColumnDefinition ColumnDefinition { get; };
AdaptiveCards.ObjectModel.Xaml_OM.IAdaptiveCardElement CardElement { get; };
xaml.UIElement Separator { get; };
xaml.Controls.Panel ParentPanel { get; };
Boolean ExpectedVisibility;
Boolean IsStretchable;
}
Expand Down

0 comments on commit 1d5826f

Please sign in to comment.