From d86a46288065218481b6f885060799de11fd689b Mon Sep 17 00:00:00 2001 From: mntone Date: Thu, 26 Jan 2023 15:31:50 +0900 Subject: [PATCH] Updates settings controls. --- src/Controls/SettingsCard.xaml | 6 +- src/Controls/SettingsCard.xaml.h | 91 +++++++++---------- src/Controls/SettingsCard.xaml.properties.cpp | 18 ++-- src/Controls/SettingsExpander.xaml | 3 +- src/Controls/SettingsExpander.xaml.h | 53 ++++++----- .../SettingsExpander.xaml.properties.cpp | 8 +- src/Controls/SettingsPanel.xaml | 3 +- src/Controls/SettingsPanel.xaml.h | 50 +++++----- .../SettingsPanel.xaml.properties.cpp | 10 +- 9 files changed, 119 insertions(+), 123 deletions(-) diff --git a/src/Controls/SettingsCard.xaml b/src/Controls/SettingsCard.xaml index 30c23fb..d720741 100644 --- a/src/Controls/SettingsCard.xaml +++ b/src/Controls/SettingsCard.xaml @@ -160,7 +160,6 @@ Content="{TemplateBinding HeaderIcon}" FontFamily="{StaticResource SymbolThemeFontFamily}" FontSize="12" - Foreground="{TemplateBinding Foreground}" HighContrastAdjustment="None" IsTextScaleFactorEnabled="False" /> @@ -171,9 +170,9 @@ - (); } - inline void ActionIcon(winrt::Microsoft::UI::Xaml::Controls::IconElement const& value) const { SetValue(props_.ActionIcon, value); } + inline Microsoft::UI::Xaml::Controls::IconElement ActionIcon() const { return GetValue(props_.ActionIcon).as(); } + inline void ActionIcon(Microsoft::UI::Xaml::Controls::IconElement const& value) const { SetValue(props_.ActionIcon, value); } - inline winrt::hstring ActionIconTooltip() const { return winrt::unbox_value(GetValue(props_.ActionIconTooltip)); } - inline void ActionIconTooltip(winrt::param::hstring const& value) const { SetValue(props_.ActionIconTooltip, winrt::box_value(value)); } + inline hstring ActionIconTooltip() const { return unbox_value(GetValue(props_.ActionIconTooltip)); } + inline void ActionIconTooltip(param::hstring const& value) const { SetValue(props_.ActionIconTooltip, box_value(value)); } - inline winrt::Windows::Foundation::IInspectable Description() const { return GetValue(props_.Description); } - inline void Description(winrt::Windows::Foundation::IInspectable const& value) const { SetValue(props_.Description, value); } + inline Windows::Foundation::IInspectable Description() const { return GetValue(props_.Description); } + inline void Description(Windows::Foundation::IInspectable const& value) const { SetValue(props_.Description, value); } - inline winrt::Microsoft::UI::Xaml::Controls::IconElement HeaderIcon() const { return GetValue(props_.HeaderIcon).as(); } - inline void HeaderIcon(winrt::Microsoft::UI::Xaml::Controls::IconElement const& value) const { SetValue(props_.HeaderIcon, value); } + inline Microsoft::UI::Xaml::Controls::IconElement HeaderIcon() const { return GetValue(props_.HeaderIcon).as(); } + inline void HeaderIcon(Microsoft::UI::Xaml::Controls::IconElement const& value) const { SetValue(props_.HeaderIcon, value); } - inline winrt::Windows::Foundation::IInspectable Header() const { return GetValue(props_.Header); } - inline void Header(winrt::Windows::Foundation::IInspectable const& value) const { SetValue(props_.Header, value); } + inline Windows::Foundation::IInspectable Header() const { return GetValue(props_.Header); } + inline void Header(Windows::Foundation::IInspectable const& value) const { SetValue(props_.Header, value); } - inline bool IsClickEnabled() const { return winrt::unbox_value(GetValue(props_.IsClickEnabled)); } - inline void IsClickEnabled(bool value) const { SetValue(props_.IsClickEnabled, winrt::box_value(value)); } + inline bool IsClickEnabled() const { return unbox_value(GetValue(props_.IsClickEnabled)); } + inline void IsClickEnabled(bool value) const { SetValue(props_.IsClickEnabled, box_value(value)); } - inline winrt::Microsoft::UI::Xaml::Controls::Orientation Orientation() const { return winrt::unbox_value(GetValue(props_.Orientation)); } - inline void Orientation(winrt::Microsoft::UI::Xaml::Controls::Orientation value) const { SetValue(props_.Orientation, winrt::box_value(value)); } + inline Microsoft::UI::Xaml::Controls::Orientation Orientation() const { return unbox_value(GetValue(props_.Orientation)); } + inline void Orientation(Microsoft::UI::Xaml::Controls::Orientation value) const { SetValue(props_.Orientation, box_value(value)); } - static winrt::Microsoft::UI::Xaml::DependencyProperty ActionIconProperty() noexcept { return props_.ActionIcon; } - static winrt::Microsoft::UI::Xaml::DependencyProperty ActionIconTooltipProperty() noexcept { return props_.ActionIconTooltip; } - static winrt::Microsoft::UI::Xaml::DependencyProperty DescriptionProperty() noexcept { return props_.Description; } - static winrt::Microsoft::UI::Xaml::DependencyProperty HeaderIconProperty() noexcept { return props_.HeaderIcon; } - static winrt::Microsoft::UI::Xaml::DependencyProperty HeaderProperty() noexcept { return props_.Header; } - static winrt::Microsoft::UI::Xaml::DependencyProperty IsClickEnabledProperty() noexcept { return props_.IsClickEnabled; } - static winrt::Microsoft::UI::Xaml::DependencyProperty OrientationProperty() noexcept { return props_.Orientation; } + inline static Microsoft::UI::Xaml::DependencyProperty ActionIconProperty() noexcept { return props_.ActionIcon; } + inline static Microsoft::UI::Xaml::DependencyProperty ActionIconTooltipProperty() noexcept { return props_.ActionIconTooltip; } + inline static Microsoft::UI::Xaml::DependencyProperty DescriptionProperty() noexcept { return props_.Description; } + inline static Microsoft::UI::Xaml::DependencyProperty HeaderIconProperty() noexcept { return props_.HeaderIcon; } + inline static Microsoft::UI::Xaml::DependencyProperty HeaderProperty() noexcept { return props_.Header; } + inline static Microsoft::UI::Xaml::DependencyProperty IsClickEnabledProperty() noexcept { return props_.IsClickEnabled; } + inline static Microsoft::UI::Xaml::DependencyProperty OrientationProperty() noexcept { return props_.Orientation; } private: // - Variables struct DependencyProperties final { void DelayInitIfNeeded(); bool initialized_ { false }; - winrt::Microsoft::UI::Xaml::DependencyProperty ActionIcon { nullptr }; - winrt::Microsoft::UI::Xaml::DependencyProperty ActionIconTooltip { nullptr }; - winrt::Microsoft::UI::Xaml::DependencyProperty Description { nullptr }; - winrt::Microsoft::UI::Xaml::DependencyProperty HeaderIcon { nullptr }; - winrt::Microsoft::UI::Xaml::DependencyProperty Header { nullptr }; - winrt::Microsoft::UI::Xaml::DependencyProperty IsClickEnabled { nullptr }; - winrt::Microsoft::UI::Xaml::DependencyProperty Orientation { nullptr }; + Microsoft::UI::Xaml::DependencyProperty ActionIcon { nullptr }; + Microsoft::UI::Xaml::DependencyProperty ActionIconTooltip { nullptr }; + Microsoft::UI::Xaml::DependencyProperty Description { nullptr }; + Microsoft::UI::Xaml::DependencyProperty HeaderIcon { nullptr }; + Microsoft::UI::Xaml::DependencyProperty Header { nullptr }; + Microsoft::UI::Xaml::DependencyProperty IsClickEnabled { nullptr }; + Microsoft::UI::Xaml::DependencyProperty Orientation { nullptr }; }; static DependencyProperties props_; }; diff --git a/src/Controls/SettingsCard.xaml.properties.cpp b/src/Controls/SettingsCard.xaml.properties.cpp index 2b22aa4..2364ced 100644 --- a/src/Controls/SettingsCard.xaml.properties.cpp +++ b/src/Controls/SettingsCard.xaml.properties.cpp @@ -22,15 +22,15 @@ void SettingsCard::DependencyProperties::DelayInitIfNeeded() { DEFINE_DP_METADATA( ActionIcon, - winrt::Microsoft::UI::Xaml::Controls::IconElement, + Microsoft::UI::Xaml::Controls::IconElement, SettingsCard, - winrt::PropertyMetadata(winrt::box_value(winrt::hstring(L"\ue974")))); + PropertyMetadata(box_value(hstring(L"\ue974")))); DEFINE_DP_METADATA( ActionIconTooltip, - winrt::hstring, + hstring, SettingsCard, - winrt::PropertyMetadata(winrt::box_value(winrt::hstring(L"More")))); + PropertyMetadata(box_value(hstring(L"More")))); DEFINE_DP_CALLBACK( Description, @@ -40,7 +40,7 @@ void SettingsCard::DependencyProperties::DelayInitIfNeeded() { DEFINE_DP_CALLBACK( HeaderIcon, - winrt::Microsoft::UI::Xaml::Controls::IconElement, + Microsoft::UI::Xaml::Controls::IconElement, SettingsCard, &SettingsCard::OnHeaderIconChangedStatic); @@ -58,11 +58,11 @@ void SettingsCard::DependencyProperties::DelayInitIfNeeded() { DEFINE_DP_METADATA( Orientation, - winrt::Microsoft::UI::Xaml::Controls::Orientation, + Microsoft::UI::Xaml::Controls::Orientation, SettingsCard, - winrt::PropertyMetadata( - winrt::box_value(winrt::Microsoft::UI::Xaml::Controls::Orientation::Horizontal), - winrt::PropertyChangedCallback(&SettingsCard::OnOrientationChangedStatic))); + PropertyMetadata( + box_value(Microsoft::UI::Xaml::Controls::Orientation::Horizontal), + PropertyChangedCallback(&SettingsCard::OnOrientationChangedStatic))); initialized_ = true; } diff --git a/src/Controls/SettingsExpander.xaml b/src/Controls/SettingsExpander.xaml index 0213a03..4409c4d 100644 --- a/src/Controls/SettingsExpander.xaml +++ b/src/Controls/SettingsExpander.xaml @@ -379,7 +379,8 @@ Content="{TemplateBinding Header}" Foreground="{TemplateBinding Foreground}" TextWrapping="Wrap" /> - (); } - inline void HeaderIcon(winrt::Microsoft::UI::Xaml::Controls::IconElement const& value) const { SetValue(props_.HeaderIcon, value); } + inline Microsoft::UI::Xaml::Controls::IconElement HeaderIcon() const { return GetValue(props_.HeaderIcon).as(); } + inline void HeaderIcon(Microsoft::UI::Xaml::Controls::IconElement const& value) const { SetValue(props_.HeaderIcon, value); } - inline winrt::Microsoft::UI::Xaml::Controls::Orientation Orientation() const { return winrt::unbox_value(GetValue(props_.Orientation)); } - inline void Orientation(winrt::Microsoft::UI::Xaml::Controls::Orientation value) const { SetValue(props_.Orientation, winrt::box_value(value)); } + inline Microsoft::UI::Xaml::Controls::Orientation Orientation() const { return winrt::unbox_value(GetValue(props_.Orientation)); } + inline void Orientation(Microsoft::UI::Xaml::Controls::Orientation value) const { SetValue(props_.Orientation, box_value(value)); } - static winrt::Microsoft::UI::Xaml::DependencyProperty DescriptionProperty() noexcept { return props_.Description; } - static winrt::Microsoft::UI::Xaml::DependencyProperty ExpanderContentProperty() noexcept { return props_.ExpanderContent; } - static winrt::Microsoft::UI::Xaml::DependencyProperty HeaderIconProperty() noexcept { return props_.HeaderIcon; } - static winrt::Microsoft::UI::Xaml::DependencyProperty OrientationProperty() noexcept { return props_.Orientation; } + inline static Microsoft::UI::Xaml::DependencyProperty DescriptionProperty() noexcept { return props_.Description; } + inline static Microsoft::UI::Xaml::DependencyProperty ExpanderContentProperty() noexcept { return props_.ExpanderContent; } + inline static Microsoft::UI::Xaml::DependencyProperty HeaderIconProperty() noexcept { return props_.HeaderIcon; } + inline static Microsoft::UI::Xaml::DependencyProperty OrientationProperty() noexcept { return props_.Orientation; } private: // - Variables struct DependencyProperties final { void DelayInitIfNeeded(); bool initialized_ { false }; - winrt::Microsoft::UI::Xaml::DependencyProperty Description { nullptr }; - winrt::Microsoft::UI::Xaml::DependencyProperty ExpanderContent { nullptr }; - winrt::Microsoft::UI::Xaml::DependencyProperty HeaderIcon { nullptr }; - winrt::Microsoft::UI::Xaml::DependencyProperty Orientation { nullptr }; + Microsoft::UI::Xaml::DependencyProperty Description { nullptr }; + Microsoft::UI::Xaml::DependencyProperty ExpanderContent { nullptr }; + Microsoft::UI::Xaml::DependencyProperty HeaderIcon { nullptr }; + Microsoft::UI::Xaml::DependencyProperty Orientation { nullptr }; }; static DependencyProperties props_; }; diff --git a/src/Controls/SettingsExpander.xaml.properties.cpp b/src/Controls/SettingsExpander.xaml.properties.cpp index f6a2b73..07f6fcd 100644 --- a/src/Controls/SettingsExpander.xaml.properties.cpp +++ b/src/Controls/SettingsExpander.xaml.properties.cpp @@ -30,16 +30,16 @@ void SettingsExpander::DependencyProperties::DelayInitIfNeeded() { DEFINE_DP_CALLBACK( HeaderIcon, - winrt::Microsoft::UI::Xaml::Controls::IconElement, + Microsoft::UI::Xaml::Controls::IconElement, SettingsExpander, &SettingsExpander::OnHeaderIconChangedStatic); DEFINE_DP_METADATA( Orientation, - winrt::Microsoft::UI::Xaml::Controls::Orientation, + Microsoft::UI::Xaml::Controls::Orientation, SettingsExpander, - winrt::PropertyMetadata( - winrt::box_value(winrt::Microsoft::UI::Xaml::Controls::Orientation::Horizontal))); + PropertyMetadata( + box_value(Microsoft::UI::Xaml::Controls::Orientation::Horizontal))); initialized_ = true; } diff --git a/src/Controls/SettingsPanel.xaml b/src/Controls/SettingsPanel.xaml index 1061fee..ceb4d62 100644 --- a/src/Controls/SettingsPanel.xaml +++ b/src/Controls/SettingsPanel.xaml @@ -91,7 +91,8 @@ AutomationProperties.AccessibilityView="Raw" Content="{TemplateBinding Header}" TextWrapping="Wrap" /> - (); } - inline void HeaderIcon(winrt::Microsoft::UI::Xaml::Controls::IconElement const& value) const { SetValue(props_.HeaderIcon, value); } + inline Microsoft::UI::Xaml::Controls::IconElement HeaderIcon() const { return GetValue(props_.HeaderIcon).as(); } + inline void HeaderIcon(Microsoft::UI::Xaml::Controls::IconElement const& value) const { SetValue(props_.HeaderIcon, value); } - inline winrt::Windows::Foundation::IInspectable Header() const { return GetValue(props_.Header); } - inline void Header(winrt::Windows::Foundation::IInspectable const& value) const { SetValue(props_.Header, value); } + inline Windows::Foundation::IInspectable Header() const { return GetValue(props_.Header); } + inline void Header(Windows::Foundation::IInspectable const& value) const { SetValue(props_.Header, value); } - inline winrt::Microsoft::UI::Xaml::Controls::Orientation Orientation() const { return winrt::unbox_value(GetValue(props_.Orientation)); } - inline void Orientation(winrt::Microsoft::UI::Xaml::Controls::Orientation value) const { SetValue(props_.Orientation, winrt::box_value(value)); } + inline Microsoft::UI::Xaml::Controls::Orientation Orientation() const { return winrt::unbox_value(GetValue(props_.Orientation)); } + inline void Orientation(Microsoft::UI::Xaml::Controls::Orientation value) const { SetValue(props_.Orientation, box_value(value)); } - static winrt::Microsoft::UI::Xaml::DependencyProperty DescriptionProperty() noexcept { return props_.Description; } - static winrt::Microsoft::UI::Xaml::DependencyProperty HeaderIconProperty() noexcept { return props_.HeaderIcon; } - static winrt::Microsoft::UI::Xaml::DependencyProperty HeaderProperty() noexcept { return props_.Header; } - static winrt::Microsoft::UI::Xaml::DependencyProperty OrientationProperty() noexcept { return props_.Orientation; } + inline static Microsoft::UI::Xaml::DependencyProperty DescriptionProperty() noexcept { return props_.Description; } + inline static Microsoft::UI::Xaml::DependencyProperty HeaderIconProperty() noexcept { return props_.HeaderIcon; } + inline static Microsoft::UI::Xaml::DependencyProperty HeaderProperty() noexcept { return props_.Header; } + inline static Microsoft::UI::Xaml::DependencyProperty OrientationProperty() noexcept { return props_.Orientation; } private: // - Variables struct DependencyProperties final { void DelayInitIfNeeded(); bool initialized_ { false }; - winrt::Microsoft::UI::Xaml::DependencyProperty Description { nullptr }; - winrt::Microsoft::UI::Xaml::DependencyProperty HeaderIcon { nullptr }; - winrt::Microsoft::UI::Xaml::DependencyProperty Header { nullptr }; - winrt::Microsoft::UI::Xaml::DependencyProperty Orientation { nullptr }; + Microsoft::UI::Xaml::DependencyProperty Description { nullptr }; + Microsoft::UI::Xaml::DependencyProperty HeaderIcon { nullptr }; + Microsoft::UI::Xaml::DependencyProperty Header { nullptr }; + Microsoft::UI::Xaml::DependencyProperty Orientation { nullptr }; }; static DependencyProperties props_; }; diff --git a/src/Controls/SettingsPanel.xaml.properties.cpp b/src/Controls/SettingsPanel.xaml.properties.cpp index 6a99068..d96a207 100644 --- a/src/Controls/SettingsPanel.xaml.properties.cpp +++ b/src/Controls/SettingsPanel.xaml.properties.cpp @@ -28,7 +28,7 @@ void SettingsPanel::DependencyProperties::DelayInitIfNeeded() { DEFINE_DP_CALLBACK( HeaderIcon, - winrt::Microsoft::UI::Xaml::Controls::IconElement, + Microsoft::UI::Xaml::Controls::IconElement, SettingsPanel, &SettingsPanel::OnHeaderIconChangedStatic); @@ -40,11 +40,11 @@ void SettingsPanel::DependencyProperties::DelayInitIfNeeded() { DEFINE_DP_METADATA( Orientation, - winrt::Microsoft::UI::Xaml::Controls::Orientation, + Microsoft::UI::Xaml::Controls::Orientation, SettingsPanel, - winrt::PropertyMetadata( - winrt::box_value(winrt::Microsoft::UI::Xaml::Controls::Orientation::Horizontal), - winrt::PropertyChangedCallback(&SettingsPanel::OnOrientationChangedStatic))); + PropertyMetadata( + box_value(Microsoft::UI::Xaml::Controls::Orientation::Horizontal), + PropertyChangedCallback(&SettingsPanel::OnOrientationChangedStatic))); initialized_ = true; }