Skip to content

Commit

Permalink
Changing TabView to contain a ListView (#971)
Browse files Browse the repository at this point in the history
Making TabView not a ListView
  • Loading branch information
teaP authored Jul 1, 2019
1 parent f9d481c commit 1c4cbef
Show file tree
Hide file tree
Showing 13 changed files with 693 additions and 97 deletions.
250 changes: 250 additions & 0 deletions dev/Generated/TabView.properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,55 @@

CppWinRTActivatableClassWithDPFactory(TabView)

GlobalDependencyProperty TabViewProperties::s_AddButtonCommandProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_AddButtonCommandParameterProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_CanCloseTabsProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_CanDragDropTabsProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_IsAddButtonVisibleProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_ItemsProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_ItemsSourceProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_ItemTemplateProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_ItemTemplateSelectorProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_LeftCustomContentProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_LeftCustomContentTemplateProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_RightCustomContentProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_RightCustomContentTemplateProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_SelectedIndexProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_SelectedItemProperty{ nullptr };
GlobalDependencyProperty TabViewProperties::s_TabWidthModeProperty{ nullptr };

TabViewProperties::TabViewProperties()
: m_addButtonClickEventSource{static_cast<TabView*>(this)}
, m_selectionChangedEventSource{static_cast<TabView*>(this)}
, m_tabClosingEventSource{static_cast<TabView*>(this)}
{
EnsureProperties();
}

void TabViewProperties::EnsureProperties()
{
if (!s_AddButtonCommandProperty)
{
s_AddButtonCommandProperty =
InitializeDependencyProperty(
L"AddButtonCommand",
winrt::name_of<winrt::ICommand>(),
winrt::name_of<winrt::TabView>(),
false /* isAttached */,
ValueHelper<winrt::ICommand>::BoxedDefaultValue(),
nullptr);
}
if (!s_AddButtonCommandParameterProperty)
{
s_AddButtonCommandParameterProperty =
InitializeDependencyProperty(
L"AddButtonCommandParameter",
winrt::name_of<winrt::IInspectable>(),
winrt::name_of<winrt::TabView>(),
false /* isAttached */,
ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
nullptr);
}
if (!s_CanCloseTabsProperty)
{
s_CanCloseTabsProperty =
Expand All @@ -36,6 +68,17 @@ void TabViewProperties::EnsureProperties()
ValueHelper<bool>::BoxValueIfNecessary(true),
nullptr);
}
if (!s_CanDragDropTabsProperty)
{
s_CanDragDropTabsProperty =
InitializeDependencyProperty(
L"CanDragDropTabs",
winrt::name_of<bool>(),
winrt::name_of<winrt::TabView>(),
false /* isAttached */,
ValueHelper<bool>::BoxValueIfNecessary(true),
nullptr);
}
if (!s_IsAddButtonVisibleProperty)
{
s_IsAddButtonVisibleProperty =
Expand All @@ -47,6 +90,50 @@ void TabViewProperties::EnsureProperties()
ValueHelper<bool>::BoxValueIfNecessary(true),
nullptr);
}
if (!s_ItemsProperty)
{
s_ItemsProperty =
InitializeDependencyProperty(
L"Items",
winrt::name_of<winrt::IVector<winrt::IInspectable>>(),
winrt::name_of<winrt::TabView>(),
false /* isAttached */,
ValueHelper<winrt::IVector<winrt::IInspectable>>::BoxedDefaultValue(),
winrt::PropertyChangedCallback(&OnItemsPropertyChanged));
}
if (!s_ItemsSourceProperty)
{
s_ItemsSourceProperty =
InitializeDependencyProperty(
L"ItemsSource",
winrt::name_of<winrt::IInspectable>(),
winrt::name_of<winrt::TabView>(),
false /* isAttached */,
ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
winrt::PropertyChangedCallback(&OnItemsSourcePropertyChanged));
}
if (!s_ItemTemplateProperty)
{
s_ItemTemplateProperty =
InitializeDependencyProperty(
L"ItemTemplate",
winrt::name_of<winrt::DataTemplate>(),
winrt::name_of<winrt::TabView>(),
false /* isAttached */,
ValueHelper<winrt::DataTemplate>::BoxedDefaultValue(),
nullptr);
}
if (!s_ItemTemplateSelectorProperty)
{
s_ItemTemplateSelectorProperty =
InitializeDependencyProperty(
L"ItemTemplateSelector",
winrt::name_of<winrt::DataTemplateSelector>(),
winrt::name_of<winrt::TabView>(),
false /* isAttached */,
ValueHelper<winrt::DataTemplateSelector>::BoxedDefaultValue(),
nullptr);
}
if (!s_LeftCustomContentProperty)
{
s_LeftCustomContentProperty =
Expand Down Expand Up @@ -91,6 +178,28 @@ void TabViewProperties::EnsureProperties()
ValueHelper<winrt::DataTemplate>::BoxedDefaultValue(),
nullptr);
}
if (!s_SelectedIndexProperty)
{
s_SelectedIndexProperty =
InitializeDependencyProperty(
L"SelectedIndex",
winrt::name_of<int>(),
winrt::name_of<winrt::TabView>(),
false /* isAttached */,
ValueHelper<int>::BoxValueIfNecessary(-1),
winrt::PropertyChangedCallback(&OnSelectedIndexPropertyChanged));
}
if (!s_SelectedItemProperty)
{
s_SelectedItemProperty =
InitializeDependencyProperty(
L"SelectedItem",
winrt::name_of<winrt::IInspectable>(),
winrt::name_of<winrt::TabView>(),
false /* isAttached */,
ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
winrt::PropertyChangedCallback(&OnSelectedItemPropertyChanged));
}
if (!s_TabWidthModeProperty)
{
s_TabWidthModeProperty =
Expand All @@ -106,15 +215,56 @@ void TabViewProperties::EnsureProperties()

void TabViewProperties::ClearProperties()
{
s_AddButtonCommandProperty = nullptr;
s_AddButtonCommandParameterProperty = nullptr;
s_CanCloseTabsProperty = nullptr;
s_CanDragDropTabsProperty = nullptr;
s_IsAddButtonVisibleProperty = nullptr;
s_ItemsProperty = nullptr;
s_ItemsSourceProperty = nullptr;
s_ItemTemplateProperty = nullptr;
s_ItemTemplateSelectorProperty = nullptr;
s_LeftCustomContentProperty = nullptr;
s_LeftCustomContentTemplateProperty = nullptr;
s_RightCustomContentProperty = nullptr;
s_RightCustomContentTemplateProperty = nullptr;
s_SelectedIndexProperty = nullptr;
s_SelectedItemProperty = nullptr;
s_TabWidthModeProperty = nullptr;
}

void TabViewProperties::OnItemsPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
{
auto owner = sender.as<winrt::TabView>();
winrt::get_self<TabView>(owner)->OnItemsPropertyChanged(args);
}

void TabViewProperties::OnItemsSourcePropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
{
auto owner = sender.as<winrt::TabView>();
winrt::get_self<TabView>(owner)->OnItemsSourcePropertyChanged(args);
}

void TabViewProperties::OnSelectedIndexPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
{
auto owner = sender.as<winrt::TabView>();
winrt::get_self<TabView>(owner)->OnSelectedIndexPropertyChanged(args);
}

void TabViewProperties::OnSelectedItemPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
{
auto owner = sender.as<winrt::TabView>();
winrt::get_self<TabView>(owner)->OnSelectedItemPropertyChanged(args);
}

void TabViewProperties::OnTabWidthModePropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
Expand All @@ -123,6 +273,26 @@ void TabViewProperties::OnTabWidthModePropertyChanged(
winrt::get_self<TabView>(owner)->OnTabWidthModePropertyChanged(args);
}

void TabViewProperties::AddButtonCommand(winrt::ICommand const& value)
{
static_cast<TabView*>(this)->SetValue(s_AddButtonCommandProperty, ValueHelper<winrt::ICommand>::BoxValueIfNecessary(value));
}

winrt::ICommand TabViewProperties::AddButtonCommand()
{
return ValueHelper<winrt::ICommand>::CastOrUnbox(static_cast<TabView*>(this)->GetValue(s_AddButtonCommandProperty));
}

void TabViewProperties::AddButtonCommandParameter(winrt::IInspectable const& value)
{
static_cast<TabView*>(this)->SetValue(s_AddButtonCommandParameterProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
}

winrt::IInspectable TabViewProperties::AddButtonCommandParameter()
{
return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<TabView*>(this)->GetValue(s_AddButtonCommandParameterProperty));
}

void TabViewProperties::CanCloseTabs(bool value)
{
static_cast<TabView*>(this)->SetValue(s_CanCloseTabsProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
Expand All @@ -133,6 +303,16 @@ bool TabViewProperties::CanCloseTabs()
return ValueHelper<bool>::CastOrUnbox(static_cast<TabView*>(this)->GetValue(s_CanCloseTabsProperty));
}

void TabViewProperties::CanDragDropTabs(bool value)
{
static_cast<TabView*>(this)->SetValue(s_CanDragDropTabsProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
}

bool TabViewProperties::CanDragDropTabs()
{
return ValueHelper<bool>::CastOrUnbox(static_cast<TabView*>(this)->GetValue(s_CanDragDropTabsProperty));
}

void TabViewProperties::IsAddButtonVisible(bool value)
{
static_cast<TabView*>(this)->SetValue(s_IsAddButtonVisibleProperty, ValueHelper<bool>::BoxValueIfNecessary(value));
Expand All @@ -143,6 +323,46 @@ bool TabViewProperties::IsAddButtonVisible()
return ValueHelper<bool>::CastOrUnbox(static_cast<TabView*>(this)->GetValue(s_IsAddButtonVisibleProperty));
}

void TabViewProperties::Items(winrt::IVector<winrt::IInspectable> const& value)
{
static_cast<TabView*>(this)->SetValue(s_ItemsProperty, ValueHelper<winrt::IVector<winrt::IInspectable>>::BoxValueIfNecessary(value));
}

winrt::IVector<winrt::IInspectable> TabViewProperties::Items()
{
return ValueHelper<winrt::IVector<winrt::IInspectable>>::CastOrUnbox(static_cast<TabView*>(this)->GetValue(s_ItemsProperty));
}

void TabViewProperties::ItemsSource(winrt::IInspectable const& value)
{
static_cast<TabView*>(this)->SetValue(s_ItemsSourceProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
}

winrt::IInspectable TabViewProperties::ItemsSource()
{
return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<TabView*>(this)->GetValue(s_ItemsSourceProperty));
}

void TabViewProperties::ItemTemplate(winrt::DataTemplate const& value)
{
static_cast<TabView*>(this)->SetValue(s_ItemTemplateProperty, ValueHelper<winrt::DataTemplate>::BoxValueIfNecessary(value));
}

winrt::DataTemplate TabViewProperties::ItemTemplate()
{
return ValueHelper<winrt::DataTemplate>::CastOrUnbox(static_cast<TabView*>(this)->GetValue(s_ItemTemplateProperty));
}

void TabViewProperties::ItemTemplateSelector(winrt::DataTemplateSelector const& value)
{
static_cast<TabView*>(this)->SetValue(s_ItemTemplateSelectorProperty, ValueHelper<winrt::DataTemplateSelector>::BoxValueIfNecessary(value));
}

winrt::DataTemplateSelector TabViewProperties::ItemTemplateSelector()
{
return ValueHelper<winrt::DataTemplateSelector>::CastOrUnbox(static_cast<TabView*>(this)->GetValue(s_ItemTemplateSelectorProperty));
}

void TabViewProperties::LeftCustomContent(winrt::IInspectable const& value)
{
static_cast<TabView*>(this)->SetValue(s_LeftCustomContentProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
Expand Down Expand Up @@ -183,6 +403,26 @@ winrt::DataTemplate TabViewProperties::RightCustomContentTemplate()
return ValueHelper<winrt::DataTemplate>::CastOrUnbox(static_cast<TabView*>(this)->GetValue(s_RightCustomContentTemplateProperty));
}

void TabViewProperties::SelectedIndex(int value)
{
static_cast<TabView*>(this)->SetValue(s_SelectedIndexProperty, ValueHelper<int>::BoxValueIfNecessary(value));
}

int TabViewProperties::SelectedIndex()
{
return ValueHelper<int>::CastOrUnbox(static_cast<TabView*>(this)->GetValue(s_SelectedIndexProperty));
}

void TabViewProperties::SelectedItem(winrt::IInspectable const& value)
{
static_cast<TabView*>(this)->SetValue(s_SelectedItemProperty, ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(value));
}

winrt::IInspectable TabViewProperties::SelectedItem()
{
return ValueHelper<winrt::IInspectable>::CastOrUnbox(static_cast<TabView*>(this)->GetValue(s_SelectedItemProperty));
}

void TabViewProperties::TabWidthMode(winrt::TabViewWidthMode const& value)
{
static_cast<TabView*>(this)->SetValue(s_TabWidthModeProperty, ValueHelper<winrt::TabViewWidthMode>::BoxValueIfNecessary(value));
Expand All @@ -203,6 +443,16 @@ void TabViewProperties::AddButtonClick(winrt::event_token const& token)
m_addButtonClickEventSource.remove(token);
}

winrt::event_token TabViewProperties::SelectionChanged(winrt::SelectionChangedEventHandler const& value)
{
return m_selectionChangedEventSource.add(value);
}

void TabViewProperties::SelectionChanged(winrt::event_token const& token)
{
m_selectionChangedEventSource.remove(token);
}

winrt::event_token TabViewProperties::TabClosing(winrt::TypedEventHandler<winrt::TabView, winrt::TabViewTabClosingEventArgs> const& value)
{
return m_tabClosingEventSource.add(value);
Expand Down
Loading

0 comments on commit 1c4cbef

Please sign in to comment.