Skip to content

Commit

Permalink
RadioButtons API feedback (#1675)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenLPeters authored and jevansaks committed Nov 26, 2019
1 parent 9870ee1 commit 3ca919e
Show file tree
Hide file tree
Showing 18 changed files with 424 additions and 141 deletions.
48 changes: 24 additions & 24 deletions dev/Generated/ColumnMajorUniformToLargestGridLayout.properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
CppWinRTActivatableClassWithDPFactory(ColumnMajorUniformToLargestGridLayout)

GlobalDependencyProperty ColumnMajorUniformToLargestGridLayoutProperties::s_ColumnSpacingProperty{ nullptr };
GlobalDependencyProperty ColumnMajorUniformToLargestGridLayoutProperties::s_MaximumColumnsProperty{ nullptr };
GlobalDependencyProperty ColumnMajorUniformToLargestGridLayoutProperties::s_MaxColumnsProperty{ nullptr };
GlobalDependencyProperty ColumnMajorUniformToLargestGridLayoutProperties::s_RowSpacingProperty{ nullptr };

ColumnMajorUniformToLargestGridLayoutProperties::ColumnMajorUniformToLargestGridLayoutProperties()
Expand All @@ -24,40 +24,40 @@ void ColumnMajorUniformToLargestGridLayoutProperties::EnsureProperties()
s_ColumnSpacingProperty =
InitializeDependencyProperty(
L"ColumnSpacing",
winrt::name_of<int>(),
winrt::name_of<double>(),
winrt::name_of<winrt::ColumnMajorUniformToLargestGridLayout>(),
false /* isAttached */,
ValueHelper<int>::BoxedDefaultValue(),
ValueHelper<double>::BoxedDefaultValue(),
winrt::PropertyChangedCallback(&OnColumnSpacingPropertyChanged));
}
if (!s_MaximumColumnsProperty)
if (!s_MaxColumnsProperty)
{
s_MaximumColumnsProperty =
s_MaxColumnsProperty =
InitializeDependencyProperty(
L"MaximumColumns",
L"MaxColumns",
winrt::name_of<int>(),
winrt::name_of<winrt::ColumnMajorUniformToLargestGridLayout>(),
false /* isAttached */,
ValueHelper<int>::BoxedDefaultValue(),
winrt::PropertyChangedCallback(&OnMaximumColumnsPropertyChanged));
winrt::PropertyChangedCallback(&OnMaxColumnsPropertyChanged));
}
if (!s_RowSpacingProperty)
{
s_RowSpacingProperty =
InitializeDependencyProperty(
L"RowSpacing",
winrt::name_of<int>(),
winrt::name_of<double>(),
winrt::name_of<winrt::ColumnMajorUniformToLargestGridLayout>(),
false /* isAttached */,
ValueHelper<int>::BoxedDefaultValue(),
ValueHelper<double>::BoxedDefaultValue(),
winrt::PropertyChangedCallback(&OnRowSpacingPropertyChanged));
}
}

void ColumnMajorUniformToLargestGridLayoutProperties::ClearProperties()
{
s_ColumnSpacingProperty = nullptr;
s_MaximumColumnsProperty = nullptr;
s_MaxColumnsProperty = nullptr;
s_RowSpacingProperty = nullptr;
}

Expand All @@ -69,7 +69,7 @@ void ColumnMajorUniformToLargestGridLayoutProperties::OnColumnSpacingPropertyCha
winrt::get_self<ColumnMajorUniformToLargestGridLayout>(owner)->OnColumnSpacingPropertyChanged(args);
}

void ColumnMajorUniformToLargestGridLayoutProperties::OnMaximumColumnsPropertyChanged(
void ColumnMajorUniformToLargestGridLayoutProperties::OnMaxColumnsPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
{
Expand All @@ -84,7 +84,7 @@ void ColumnMajorUniformToLargestGridLayoutProperties::OnMaximumColumnsPropertyCh
return;
}

winrt::get_self<ColumnMajorUniformToLargestGridLayout>(owner)->OnMaximumColumnsPropertyChanged(args);
winrt::get_self<ColumnMajorUniformToLargestGridLayout>(owner)->OnMaxColumnsPropertyChanged(args);
}

void ColumnMajorUniformToLargestGridLayoutProperties::OnRowSpacingPropertyChanged(
Expand All @@ -95,34 +95,34 @@ void ColumnMajorUniformToLargestGridLayoutProperties::OnRowSpacingPropertyChange
winrt::get_self<ColumnMajorUniformToLargestGridLayout>(owner)->OnRowSpacingPropertyChanged(args);
}

void ColumnMajorUniformToLargestGridLayoutProperties::ColumnSpacing(int value)
void ColumnMajorUniformToLargestGridLayoutProperties::ColumnSpacing(double value)
{
static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->SetValue(s_ColumnSpacingProperty, ValueHelper<int>::BoxValueIfNecessary(value));
static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->SetValue(s_ColumnSpacingProperty, ValueHelper<double>::BoxValueIfNecessary(value));
}

int ColumnMajorUniformToLargestGridLayoutProperties::ColumnSpacing()
double ColumnMajorUniformToLargestGridLayoutProperties::ColumnSpacing()
{
return ValueHelper<int>::CastOrUnbox(static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->GetValue(s_ColumnSpacingProperty));
return ValueHelper<double>::CastOrUnbox(static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->GetValue(s_ColumnSpacingProperty));
}

void ColumnMajorUniformToLargestGridLayoutProperties::MaximumColumns(int value)
void ColumnMajorUniformToLargestGridLayoutProperties::MaxColumns(int value)
{
int coercedValue = value;
static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->ValidateGreaterThanZero(coercedValue);
static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->SetValue(s_MaximumColumnsProperty, ValueHelper<int>::BoxValueIfNecessary(coercedValue));
static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->SetValue(s_MaxColumnsProperty, ValueHelper<int>::BoxValueIfNecessary(coercedValue));
}

int ColumnMajorUniformToLargestGridLayoutProperties::MaximumColumns()
int ColumnMajorUniformToLargestGridLayoutProperties::MaxColumns()
{
return ValueHelper<int>::CastOrUnbox(static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->GetValue(s_MaximumColumnsProperty));
return ValueHelper<int>::CastOrUnbox(static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->GetValue(s_MaxColumnsProperty));
}

void ColumnMajorUniformToLargestGridLayoutProperties::RowSpacing(int value)
void ColumnMajorUniformToLargestGridLayoutProperties::RowSpacing(double value)
{
static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->SetValue(s_RowSpacingProperty, ValueHelper<int>::BoxValueIfNecessary(value));
static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->SetValue(s_RowSpacingProperty, ValueHelper<double>::BoxValueIfNecessary(value));
}

int ColumnMajorUniformToLargestGridLayoutProperties::RowSpacing()
double ColumnMajorUniformToLargestGridLayoutProperties::RowSpacing()
{
return ValueHelper<int>::CastOrUnbox(static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->GetValue(s_RowSpacingProperty));
return ValueHelper<double>::CastOrUnbox(static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->GetValue(s_RowSpacingProperty));
}
18 changes: 9 additions & 9 deletions dev/Generated/ColumnMajorUniformToLargestGridLayout.properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ class ColumnMajorUniformToLargestGridLayoutProperties
public:
ColumnMajorUniformToLargestGridLayoutProperties();

void ColumnSpacing(int value);
int ColumnSpacing();
void ColumnSpacing(double value);
double ColumnSpacing();

void MaximumColumns(int value);
int MaximumColumns();
void MaxColumns(int value);
int MaxColumns();

void RowSpacing(int value);
int RowSpacing();
void RowSpacing(double value);
double RowSpacing();

static winrt::DependencyProperty ColumnSpacingProperty() { return s_ColumnSpacingProperty; }
static winrt::DependencyProperty MaximumColumnsProperty() { return s_MaximumColumnsProperty; }
static winrt::DependencyProperty MaxColumnsProperty() { return s_MaxColumnsProperty; }
static winrt::DependencyProperty RowSpacingProperty() { return s_RowSpacingProperty; }

static GlobalDependencyProperty s_ColumnSpacingProperty;
static GlobalDependencyProperty s_MaximumColumnsProperty;
static GlobalDependencyProperty s_MaxColumnsProperty;
static GlobalDependencyProperty s_RowSpacingProperty;

static void EnsureProperties();
Expand All @@ -33,7 +33,7 @@ class ColumnMajorUniformToLargestGridLayoutProperties
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args);

static void OnMaximumColumnsPropertyChanged(
static void OnMaxColumnsPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args);

Expand Down
55 changes: 43 additions & 12 deletions dev/Generated/RadioButtons.properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
CppWinRTActivatableClassWithDPFactory(RadioButtons)

GlobalDependencyProperty RadioButtonsProperties::s_HeaderProperty{ nullptr };
GlobalDependencyProperty RadioButtonsProperties::s_HeaderTemplateProperty{ nullptr };
GlobalDependencyProperty RadioButtonsProperties::s_ItemsProperty{ nullptr };
GlobalDependencyProperty RadioButtonsProperties::s_ItemsSourceProperty{ nullptr };
GlobalDependencyProperty RadioButtonsProperties::s_ItemTemplateProperty{ nullptr };
GlobalDependencyProperty RadioButtonsProperties::s_MaximumColumnsProperty{ nullptr };
GlobalDependencyProperty RadioButtonsProperties::s_MaxColumnsProperty{ nullptr };
GlobalDependencyProperty RadioButtonsProperties::s_SelectedIndexProperty{ nullptr };
GlobalDependencyProperty RadioButtonsProperties::s_SelectedItemProperty{ nullptr };

Expand All @@ -35,6 +36,17 @@ void RadioButtonsProperties::EnsureProperties()
ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
winrt::PropertyChangedCallback(&OnHeaderPropertyChanged));
}
if (!s_HeaderTemplateProperty)
{
s_HeaderTemplateProperty =
InitializeDependencyProperty(
L"HeaderTemplate",
winrt::name_of<winrt::DataTemplate>(),
winrt::name_of<winrt::RadioButtons>(),
false /* isAttached */,
ValueHelper<winrt::DataTemplate>::BoxedDefaultValue(),
winrt::PropertyChangedCallback(&OnHeaderTemplatePropertyChanged));
}
if (!s_ItemsProperty)
{
s_ItemsProperty =
Expand Down Expand Up @@ -65,19 +77,19 @@ void RadioButtonsProperties::EnsureProperties()
winrt::name_of<winrt::IInspectable>(),
winrt::name_of<winrt::RadioButtons>(),
false /* isAttached */,
ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(winrt::RadioButtonsElementFactory{}),
ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(winrt::make<RadioButtonsElementFactory>()),
winrt::PropertyChangedCallback(&OnItemTemplatePropertyChanged));
}
if (!s_MaximumColumnsProperty)
if (!s_MaxColumnsProperty)
{
s_MaximumColumnsProperty =
s_MaxColumnsProperty =
InitializeDependencyProperty(
L"MaximumColumns",
L"MaxColumns",
winrt::name_of<int>(),
winrt::name_of<winrt::RadioButtons>(),
false /* isAttached */,
ValueHelper<int>::BoxValueIfNecessary(1),
winrt::PropertyChangedCallback(&OnMaximumColumnsPropertyChanged));
winrt::PropertyChangedCallback(&OnMaxColumnsPropertyChanged));
}
if (!s_SelectedIndexProperty)
{
Expand Down Expand Up @@ -106,10 +118,11 @@ void RadioButtonsProperties::EnsureProperties()
void RadioButtonsProperties::ClearProperties()
{
s_HeaderProperty = nullptr;
s_HeaderTemplateProperty = nullptr;
s_ItemsProperty = nullptr;
s_ItemsSourceProperty = nullptr;
s_ItemTemplateProperty = nullptr;
s_MaximumColumnsProperty = nullptr;
s_MaxColumnsProperty = nullptr;
s_SelectedIndexProperty = nullptr;
s_SelectedItemProperty = nullptr;
}
Expand All @@ -122,6 +135,14 @@ void RadioButtonsProperties::OnHeaderPropertyChanged(
winrt::get_self<RadioButtons>(owner)->OnPropertyChanged(args);
}

void RadioButtonsProperties::OnHeaderTemplatePropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
{
auto owner = sender.as<winrt::RadioButtons>();
winrt::get_self<RadioButtons>(owner)->OnPropertyChanged(args);
}

void RadioButtonsProperties::OnItemsPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
Expand All @@ -146,7 +167,7 @@ void RadioButtonsProperties::OnItemTemplatePropertyChanged(
winrt::get_self<RadioButtons>(owner)->OnPropertyChanged(args);
}

void RadioButtonsProperties::OnMaximumColumnsPropertyChanged(
void RadioButtonsProperties::OnMaxColumnsPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
{
Expand Down Expand Up @@ -180,6 +201,16 @@ winrt::IInspectable RadioButtonsProperties::Header()
return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<RadioButtons*>(this)->GetValue(s_HeaderProperty));
}

void RadioButtonsProperties::HeaderTemplate(winrt::DataTemplate const& value)
{
static_cast<RadioButtons*>(this)->SetValue(s_HeaderTemplateProperty, ValueHelper<winrt::DataTemplate>::BoxValueIfNecessary(value));
}

winrt::DataTemplate RadioButtonsProperties::HeaderTemplate()
{
return ValueHelper<winrt::DataTemplate>::CastOrUnbox(static_cast<RadioButtons*>(this)->GetValue(s_HeaderTemplateProperty));
}

void RadioButtonsProperties::Items(winrt::IVector<winrt::IInspectable> const& value)
{
static_cast<RadioButtons*>(this)->SetValue(s_ItemsProperty, ValueHelper<winrt::IVector<winrt::IInspectable>>::BoxValueIfNecessary(value));
Expand Down Expand Up @@ -210,14 +241,14 @@ winrt::IInspectable RadioButtonsProperties::ItemTemplate()
return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<RadioButtons*>(this)->GetValue(s_ItemTemplateProperty));
}

void RadioButtonsProperties::MaximumColumns(int value)
void RadioButtonsProperties::MaxColumns(int value)
{
static_cast<RadioButtons*>(this)->SetValue(s_MaximumColumnsProperty, ValueHelper<int>::BoxValueIfNecessary(value));
static_cast<RadioButtons*>(this)->SetValue(s_MaxColumnsProperty, ValueHelper<int>::BoxValueIfNecessary(value));
}

int RadioButtonsProperties::MaximumColumns()
int RadioButtonsProperties::MaxColumns()
{
return ValueHelper<int>::CastOrUnbox(static_cast<RadioButtons*>(this)->GetValue(s_MaximumColumnsProperty));
return ValueHelper<int>::CastOrUnbox(static_cast<RadioButtons*>(this)->GetValue(s_MaxColumnsProperty));
}

void RadioButtonsProperties::SelectedIndex(int value)
Expand Down
19 changes: 14 additions & 5 deletions dev/Generated/RadioButtons.properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class RadioButtonsProperties
void Header(winrt::IInspectable const& value);
winrt::IInspectable Header();

void HeaderTemplate(winrt::DataTemplate const& value);
winrt::DataTemplate HeaderTemplate();

void Items(winrt::IVector<winrt::IInspectable> const& value);
winrt::IVector<winrt::IInspectable> Items();

Expand All @@ -21,8 +24,8 @@ class RadioButtonsProperties
void ItemTemplate(winrt::IInspectable const& value);
winrt::IInspectable ItemTemplate();

void MaximumColumns(int value);
int MaximumColumns();
void MaxColumns(int value);
int MaxColumns();

void SelectedIndex(int value);
int SelectedIndex();
Expand All @@ -31,18 +34,20 @@ class RadioButtonsProperties
winrt::IInspectable SelectedItem();

static winrt::DependencyProperty HeaderProperty() { return s_HeaderProperty; }
static winrt::DependencyProperty HeaderTemplateProperty() { return s_HeaderTemplateProperty; }
static winrt::DependencyProperty ItemsProperty() { return s_ItemsProperty; }
static winrt::DependencyProperty ItemsSourceProperty() { return s_ItemsSourceProperty; }
static winrt::DependencyProperty ItemTemplateProperty() { return s_ItemTemplateProperty; }
static winrt::DependencyProperty MaximumColumnsProperty() { return s_MaximumColumnsProperty; }
static winrt::DependencyProperty MaxColumnsProperty() { return s_MaxColumnsProperty; }
static winrt::DependencyProperty SelectedIndexProperty() { return s_SelectedIndexProperty; }
static winrt::DependencyProperty SelectedItemProperty() { return s_SelectedItemProperty; }

static GlobalDependencyProperty s_HeaderProperty;
static GlobalDependencyProperty s_HeaderTemplateProperty;
static GlobalDependencyProperty s_ItemsProperty;
static GlobalDependencyProperty s_ItemsSourceProperty;
static GlobalDependencyProperty s_ItemTemplateProperty;
static GlobalDependencyProperty s_MaximumColumnsProperty;
static GlobalDependencyProperty s_MaxColumnsProperty;
static GlobalDependencyProperty s_SelectedIndexProperty;
static GlobalDependencyProperty s_SelectedItemProperty;

Expand All @@ -58,6 +63,10 @@ class RadioButtonsProperties
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args);

static void OnHeaderTemplatePropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args);

static void OnItemsPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args);
Expand All @@ -70,7 +79,7 @@ class RadioButtonsProperties
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args);

static void OnMaximumColumnsPropertyChanged(
static void OnMaxColumnsPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args);

Expand Down
Loading

0 comments on commit 3ca919e

Please sign in to comment.