Skip to content

Commit

Permalink
More InfoBarPanel API udpates (#3739)
Browse files Browse the repository at this point in the history
* update API names

* update to use all the padding/margin properties

* Update for PR comments.

Co-authored-by: Tammy Paine <[email protected]>
  • Loading branch information
ranjeshj and teaP committed Dec 3, 2020
1 parent 38a38d9 commit 1d28ea2
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 101 deletions.
84 changes: 42 additions & 42 deletions dev/Generated/InfoBarPanel.properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ namespace winrt::Microsoft::UI::Xaml::Controls::Primitives

#include "InfoBarPanel.g.cpp"

GlobalDependencyProperty InfoBarPanelProperties::s_PaddingInHorizontalOrientationProperty{ nullptr };
GlobalDependencyProperty InfoBarPanelProperties::s_PaddingInVerticalOrientationProperty{ nullptr };
GlobalDependencyProperty InfoBarPanelProperties::s_SpacingInHorizontalOrientationProperty{ nullptr };
GlobalDependencyProperty InfoBarPanelProperties::s_SpacingInVerticalOrientationProperty{ nullptr };
GlobalDependencyProperty InfoBarPanelProperties::s_HorizontalOrientationMarginProperty{ nullptr };
GlobalDependencyProperty InfoBarPanelProperties::s_HorizontalOrientationPaddingProperty{ nullptr };
GlobalDependencyProperty InfoBarPanelProperties::s_VerticalOrientationMarginProperty{ nullptr };
GlobalDependencyProperty InfoBarPanelProperties::s_VerticalOrientationPaddingProperty{ nullptr };

InfoBarPanelProperties::InfoBarPanelProperties()
{
Expand All @@ -25,104 +25,104 @@ InfoBarPanelProperties::InfoBarPanelProperties()

void InfoBarPanelProperties::EnsureProperties()
{
if (!s_PaddingInHorizontalOrientationProperty)
if (!s_HorizontalOrientationMarginProperty)
{
s_PaddingInHorizontalOrientationProperty =
s_HorizontalOrientationMarginProperty =
InitializeDependencyProperty(
L"PaddingInHorizontalOrientation",
L"HorizontalOrientationMargin",
winrt::name_of<winrt::Thickness>(),
winrt::name_of<winrt::InfoBarPanel>(),
false /* isAttached */,
true /* isAttached */,
ValueHelper<winrt::Thickness>::BoxedDefaultValue(),
nullptr);
}
if (!s_PaddingInVerticalOrientationProperty)
if (!s_HorizontalOrientationPaddingProperty)
{
s_PaddingInVerticalOrientationProperty =
s_HorizontalOrientationPaddingProperty =
InitializeDependencyProperty(
L"PaddingInVerticalOrientation",
L"HorizontalOrientationPadding",
winrt::name_of<winrt::Thickness>(),
winrt::name_of<winrt::InfoBarPanel>(),
false /* isAttached */,
ValueHelper<winrt::Thickness>::BoxedDefaultValue(),
nullptr);
}
if (!s_SpacingInHorizontalOrientationProperty)
if (!s_VerticalOrientationMarginProperty)
{
s_SpacingInHorizontalOrientationProperty =
s_VerticalOrientationMarginProperty =
InitializeDependencyProperty(
L"SpacingInHorizontalOrientation",
L"VerticalOrientationMargin",
winrt::name_of<winrt::Thickness>(),
winrt::name_of<winrt::InfoBarPanel>(),
true /* isAttached */,
ValueHelper<winrt::Thickness>::BoxedDefaultValue(),
nullptr);
}
if (!s_SpacingInVerticalOrientationProperty)
if (!s_VerticalOrientationPaddingProperty)
{
s_SpacingInVerticalOrientationProperty =
s_VerticalOrientationPaddingProperty =
InitializeDependencyProperty(
L"SpacingInVerticalOrientation",
L"VerticalOrientationPadding",
winrt::name_of<winrt::Thickness>(),
winrt::name_of<winrt::InfoBarPanel>(),
true /* isAttached */,
false /* isAttached */,
ValueHelper<winrt::Thickness>::BoxedDefaultValue(),
nullptr);
}
}

void InfoBarPanelProperties::ClearProperties()
{
s_PaddingInHorizontalOrientationProperty = nullptr;
s_PaddingInVerticalOrientationProperty = nullptr;
s_SpacingInHorizontalOrientationProperty = nullptr;
s_SpacingInVerticalOrientationProperty = nullptr;
s_HorizontalOrientationMarginProperty = nullptr;
s_HorizontalOrientationPaddingProperty = nullptr;
s_VerticalOrientationMarginProperty = nullptr;
s_VerticalOrientationPaddingProperty = nullptr;
}

void InfoBarPanelProperties::PaddingInHorizontalOrientation(winrt::Thickness const& value)

void InfoBarPanelProperties::SetHorizontalOrientationMargin(winrt::DependencyObject const& target, winrt::Thickness const& value)
{
[[gsl::suppress(con)]]
{
static_cast<InfoBarPanel*>(this)->SetValue(s_PaddingInHorizontalOrientationProperty, ValueHelper<winrt::Thickness>::BoxValueIfNecessary(value));
}
target.SetValue(s_HorizontalOrientationMarginProperty, ValueHelper<winrt::Thickness>::BoxValueIfNecessary(value));
}

winrt::Thickness InfoBarPanelProperties::PaddingInHorizontalOrientation()
winrt::Thickness InfoBarPanelProperties::GetHorizontalOrientationMargin(winrt::DependencyObject const& target)
{
return ValueHelper<winrt::Thickness>::CastOrUnbox(static_cast<InfoBarPanel*>(this)->GetValue(s_PaddingInHorizontalOrientationProperty));
return ValueHelper<winrt::Thickness>::CastOrUnbox(target.GetValue(s_HorizontalOrientationMarginProperty));
}

void InfoBarPanelProperties::PaddingInVerticalOrientation(winrt::Thickness const& value)
void InfoBarPanelProperties::HorizontalOrientationPadding(winrt::Thickness const& value)
{
[[gsl::suppress(con)]]
{
static_cast<InfoBarPanel*>(this)->SetValue(s_PaddingInVerticalOrientationProperty, ValueHelper<winrt::Thickness>::BoxValueIfNecessary(value));
static_cast<InfoBarPanel*>(this)->SetValue(s_HorizontalOrientationPaddingProperty, ValueHelper<winrt::Thickness>::BoxValueIfNecessary(value));
}
}

winrt::Thickness InfoBarPanelProperties::PaddingInVerticalOrientation()
winrt::Thickness InfoBarPanelProperties::HorizontalOrientationPadding()
{
return ValueHelper<winrt::Thickness>::CastOrUnbox(static_cast<InfoBarPanel*>(this)->GetValue(s_PaddingInVerticalOrientationProperty));
return ValueHelper<winrt::Thickness>::CastOrUnbox(static_cast<InfoBarPanel*>(this)->GetValue(s_HorizontalOrientationPaddingProperty));
}


void InfoBarPanelProperties::SetSpacingInHorizontalOrientation(winrt::DependencyObject const& target, winrt::Thickness const& value)
void InfoBarPanelProperties::SetVerticalOrientationMargin(winrt::DependencyObject const& target, winrt::Thickness const& value)
{
target.SetValue(s_SpacingInHorizontalOrientationProperty, ValueHelper<winrt::Thickness>::BoxValueIfNecessary(value));
target.SetValue(s_VerticalOrientationMarginProperty, ValueHelper<winrt::Thickness>::BoxValueIfNecessary(value));
}

winrt::Thickness InfoBarPanelProperties::GetSpacingInHorizontalOrientation(winrt::DependencyObject const& target)
winrt::Thickness InfoBarPanelProperties::GetVerticalOrientationMargin(winrt::DependencyObject const& target)
{
return ValueHelper<winrt::Thickness>::CastOrUnbox(target.GetValue(s_SpacingInHorizontalOrientationProperty));
return ValueHelper<winrt::Thickness>::CastOrUnbox(target.GetValue(s_VerticalOrientationMarginProperty));
}


void InfoBarPanelProperties::SetSpacingInVerticalOrientation(winrt::DependencyObject const& target, winrt::Thickness const& value)
void InfoBarPanelProperties::VerticalOrientationPadding(winrt::Thickness const& value)
{
target.SetValue(s_SpacingInVerticalOrientationProperty, ValueHelper<winrt::Thickness>::BoxValueIfNecessary(value));
[[gsl::suppress(con)]]
{
static_cast<InfoBarPanel*>(this)->SetValue(s_VerticalOrientationPaddingProperty, ValueHelper<winrt::Thickness>::BoxValueIfNecessary(value));
}
}

winrt::Thickness InfoBarPanelProperties::GetSpacingInVerticalOrientation(winrt::DependencyObject const& target)
winrt::Thickness InfoBarPanelProperties::VerticalOrientationPadding()
{
return ValueHelper<winrt::Thickness>::CastOrUnbox(target.GetValue(s_SpacingInVerticalOrientationProperty));
return ValueHelper<winrt::Thickness>::CastOrUnbox(static_cast<InfoBarPanel*>(this)->GetValue(s_VerticalOrientationPaddingProperty));
}
32 changes: 16 additions & 16 deletions dev/Generated/InfoBarPanel.properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ class InfoBarPanelProperties
public:
InfoBarPanelProperties();

void PaddingInHorizontalOrientation(winrt::Thickness const& value);
winrt::Thickness PaddingInHorizontalOrientation();
static void SetHorizontalOrientationMargin(winrt::DependencyObject const& target, winrt::Thickness const& value);
static winrt::Thickness GetHorizontalOrientationMargin(winrt::DependencyObject const& target);

void PaddingInVerticalOrientation(winrt::Thickness const& value);
winrt::Thickness PaddingInVerticalOrientation();
void HorizontalOrientationPadding(winrt::Thickness const& value);
winrt::Thickness HorizontalOrientationPadding();

static void SetSpacingInHorizontalOrientation(winrt::DependencyObject const& target, winrt::Thickness const& value);
static winrt::Thickness GetSpacingInHorizontalOrientation(winrt::DependencyObject const& target);
static void SetVerticalOrientationMargin(winrt::DependencyObject const& target, winrt::Thickness const& value);
static winrt::Thickness GetVerticalOrientationMargin(winrt::DependencyObject const& target);

static void SetSpacingInVerticalOrientation(winrt::DependencyObject const& target, winrt::Thickness const& value);
static winrt::Thickness GetSpacingInVerticalOrientation(winrt::DependencyObject const& target);
void VerticalOrientationPadding(winrt::Thickness const& value);
winrt::Thickness VerticalOrientationPadding();

static winrt::DependencyProperty PaddingInHorizontalOrientationProperty() { return s_PaddingInHorizontalOrientationProperty; }
static winrt::DependencyProperty PaddingInVerticalOrientationProperty() { return s_PaddingInVerticalOrientationProperty; }
static winrt::DependencyProperty SpacingInHorizontalOrientationProperty() { return s_SpacingInHorizontalOrientationProperty; }
static winrt::DependencyProperty SpacingInVerticalOrientationProperty() { return s_SpacingInVerticalOrientationProperty; }
static winrt::DependencyProperty HorizontalOrientationMarginProperty() { return s_HorizontalOrientationMarginProperty; }
static winrt::DependencyProperty HorizontalOrientationPaddingProperty() { return s_HorizontalOrientationPaddingProperty; }
static winrt::DependencyProperty VerticalOrientationMarginProperty() { return s_VerticalOrientationMarginProperty; }
static winrt::DependencyProperty VerticalOrientationPaddingProperty() { return s_VerticalOrientationPaddingProperty; }

static GlobalDependencyProperty s_PaddingInHorizontalOrientationProperty;
static GlobalDependencyProperty s_PaddingInVerticalOrientationProperty;
static GlobalDependencyProperty s_SpacingInHorizontalOrientationProperty;
static GlobalDependencyProperty s_SpacingInVerticalOrientationProperty;
static GlobalDependencyProperty s_HorizontalOrientationMarginProperty;
static GlobalDependencyProperty s_HorizontalOrientationPaddingProperty;
static GlobalDependencyProperty s_VerticalOrientationMarginProperty;
static GlobalDependencyProperty s_VerticalOrientationPaddingProperty;

static void EnsureProperties();
static void ClearProperties();
Expand Down
20 changes: 10 additions & 10 deletions dev/InfoBar/InfoBar.idl
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,19 @@ unsealed runtimeclass InfoBarPanel : Windows.UI.Xaml.Controls.Panel
{
InfoBarPanel();

Windows.UI.Xaml.Thickness PaddingInHorizontalOrientation;
static Windows.UI.Xaml.DependencyProperty PaddingInHorizontalOrientationProperty{ get; };
Windows.UI.Xaml.Thickness HorizontalOrientationPadding;
static Windows.UI.Xaml.DependencyProperty HorizontalOrientationPaddingProperty{ get; };

Windows.UI.Xaml.Thickness PaddingInVerticalOrientation;
static Windows.UI.Xaml.DependencyProperty PaddingInVerticalOrientationProperty{ get; };
Windows.UI.Xaml.Thickness VerticalOrientationPadding;
static Windows.UI.Xaml.DependencyProperty VerticalOrientationPaddingProperty{ get; };

static void SetSpacingInHorizontalOrientation(Windows.UI.Xaml.DependencyObject object, Windows.UI.Xaml.Thickness value);
static Windows.UI.Xaml.Thickness GetSpacingInHorizontalOrientation(Windows.UI.Xaml.DependencyObject object);
static Windows.UI.Xaml.DependencyProperty SpacingInHorizontalOrientationProperty{ get; };
static void SetHorizontalOrientationMargin(Windows.UI.Xaml.DependencyObject object, Windows.UI.Xaml.Thickness value);
static Windows.UI.Xaml.Thickness GetHorizontalOrientationMargin(Windows.UI.Xaml.DependencyObject object);
static Windows.UI.Xaml.DependencyProperty HorizontalOrientationMarginProperty{ get; };

static void SetSpacingInVerticalOrientation(Windows.UI.Xaml.DependencyObject object, Windows.UI.Xaml.Thickness value);
static Windows.UI.Xaml.Thickness GetSpacingInVerticalOrientation(Windows.UI.Xaml.DependencyObject object);
static Windows.UI.Xaml.DependencyProperty SpacingInVerticalOrientationProperty{ get; };
static void SetVerticalOrientationMargin(Windows.UI.Xaml.DependencyObject object, Windows.UI.Xaml.Thickness value);
static Windows.UI.Xaml.Thickness GetVerticalOrientationMargin(Windows.UI.Xaml.DependencyObject object);
static Windows.UI.Xaml.DependencyProperty VerticalOrientationMarginProperty{ get; };
}

}
Expand Down
16 changes: 8 additions & 8 deletions dev/InfoBar/InfoBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@
<primitives:InfoBarPanel
Grid.Column="1"
Margin="{StaticResource InfoBarPanelMargin}"
PaddingInHorizontalOrientation="{StaticResource InfoBarPanelPaddingInHorizontalOrientation}"
PaddingInVerticalOrientation="{StaticResource InfoBarPanelPaddingInVerticalOrientation}">
HorizontalOrientationPadding="{StaticResource InfoBarPanelHorizontalOrientationPadding}"
VerticalOrientationPadding="{StaticResource InfoBarPanelVerticalOrientationPadding}">

<TextBlock x:Name="Title"
Text="{TemplateBinding Title}"
Foreground="{ThemeResource InfoBarTitleForeground}"
primitives:InfoBarPanel.SpacingInHorizontalOrientation="{StaticResource InfoBarTitleSpacingInHorizontalOrientation}"
primitives:InfoBarPanel.SpacingInVerticalOrientation="{StaticResource InfoBarTitleSpacingInVerticalOrientation}"
primitives:InfoBarPanel.HorizontalOrientationMargin="{StaticResource InfoBarTitleHorizontalOrientationMargin}"
primitives:InfoBarPanel.VerticalOrientationMargin="{StaticResource InfoBarTitleVerticalOrientationMargin}"
TextWrapping="WrapWholeWords"
AutomationProperties.LandmarkType="Navigation"
FontWeight="{StaticResource InfoBarTitleFontWeight}"
Expand All @@ -152,15 +152,15 @@
<TextBlock x:Name="Message"
Text="{TemplateBinding Message}"
Foreground="{ThemeResource InfoBarMessageForeground}"
primitives:InfoBarPanel.SpacingInHorizontalOrientation="{StaticResource InfoBarMessageSpacingInHorizontalOrientation}"
primitives:InfoBarPanel.SpacingInVerticalOrientation="{StaticResource InfoBarMessageSpacingInVerticalOrientation}"
primitives:InfoBarPanel.HorizontalOrientationMargin="{StaticResource InfoBarMessageHorizontalOrientationMargin}"
primitives:InfoBarPanel.VerticalOrientationMargin="{StaticResource InfoBarMessageVerticalOrientationMargin}"
TextWrapping="WrapWholeWords"
FontWeight="{StaticResource InfoBarMessageFontWeight}"
FontSize="{StaticResource InfoBarMessageFontSize}"/>

<ContentPresenter
primitives:InfoBarPanel.SpacingInHorizontalOrientation="{StaticResource InfoBarActionSpacingInHorizontalOrientation}"
primitives:InfoBarPanel.SpacingInVerticalOrientation="{StaticResource InfoBarActionSpacingInVerticalOrientation}"
primitives:InfoBarPanel.HorizontalOrientationMargin="{StaticResource InfoBarActionHorizontalOrientationMargin}"
primitives:InfoBarPanel.VerticalOrientationMargin="{StaticResource InfoBarActionVerticalOrientationMargin}"
VerticalAlignment="Top"
Content="{TemplateBinding ActionButton}">

Expand Down
Loading

0 comments on commit 1d28ea2

Please sign in to comment.