mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-20 13:10:55 +00:00
Compare commits
1 Commits
dev/lhecke
...
dev/cazamo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4f1c4d3e4 |
@@ -93,6 +93,10 @@
|
||||
<SubType>Code</SubType>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SegoeFluentIconList.h" />
|
||||
<ClInclude Include="SettingsCard.h">
|
||||
<DependentUpon>SettingsCard.idl</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TerminalColorConverters.h">
|
||||
<DependentUpon>TerminalColorConverters.idl</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
@@ -230,6 +234,9 @@
|
||||
<Page Include="SettingContainerStyle.xaml">
|
||||
<Type>DefaultStyle</Type>
|
||||
</Page>
|
||||
<Page Include="SettingsCard.xaml">
|
||||
<Type>DefaultStyle</Type>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<!-- ========================= Cpp Files ======================== -->
|
||||
<ItemGroup>
|
||||
@@ -284,6 +291,10 @@
|
||||
<DependentUpon>ActionsViewModel.idl</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SettingsCard.cpp">
|
||||
<DependentUpon>SettingsCard.idl</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TerminalColorConverters.cpp">
|
||||
<DependentUpon>TerminalColorConverters.idl</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
@@ -450,6 +461,9 @@
|
||||
<Midl Include="SettingContainer.idl">
|
||||
<SubType>Code</SubType>
|
||||
</Midl>
|
||||
<Midl Include="SettingsCard.idl">
|
||||
<SubType>Code</SubType>
|
||||
</Midl>
|
||||
</ItemGroup>
|
||||
<!-- ========================= Misc Files ======================== -->
|
||||
<ItemGroup>
|
||||
|
||||
@@ -28,9 +28,11 @@
|
||||
<Midl Include="GlobalAppearanceViewModel.idl" />
|
||||
<Midl Include="LaunchViewModel.idl" />
|
||||
<Midl Include="EnumEntry.idl" />
|
||||
<Midl Include="SettingContainer.idl" />
|
||||
<Midl Include="TerminalColorConverters.idl" />
|
||||
<Midl Include="NewTabMenuViewModel.idl" />
|
||||
<Midl Include="SettingContainer.idl">
|
||||
<Filter>SettingContainers</Filter>
|
||||
</Midl>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="$(ProjectName).def" />
|
||||
@@ -49,10 +51,24 @@
|
||||
<Page Include="Appearances.xaml" />
|
||||
<Page Include="Rendering.xaml" />
|
||||
<Page Include="Actions.xaml" />
|
||||
<Page Include="SettingContainerStyle.xaml" />
|
||||
<Page Include="AddProfile.xaml" />
|
||||
<Page Include="KeyChordListener.xaml" />
|
||||
<Page Include="NullableColorPicker.xaml" />
|
||||
<Page Include="NewTabMenu.xaml" />
|
||||
<Page Include="Compatibility.xaml" />
|
||||
<Page Include="Extensions.xaml" />
|
||||
<Page Include="Profiles_Base_Orphaned.xaml" />
|
||||
<Page Include="Profiles_Terminal.xaml" />
|
||||
<Page Include="SettingsCard.xaml">
|
||||
<Filter>SettingContainers</Filter>
|
||||
</Page>
|
||||
<Page Include="SettingContainerStyle.xaml">
|
||||
<Filter>SettingContainers</Filter>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="SettingContainers">
|
||||
<UniqueIdentifier>{4e97fe02-a5fb-44f2-80d1-fb78c39c75c3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
142
src/cascadia/TerminalSettingsEditor/SettingsCard.cpp
Normal file
142
src/cascadia/TerminalSettingsEditor/SettingsCard.cpp
Normal file
@@ -0,0 +1,142 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "pch.h"
|
||||
#include "SettingsCard.h"
|
||||
#include "SettingsCard.g.cpp"
|
||||
#include "LibraryResources.h"
|
||||
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
DependencyProperty SettingsCard::_HeaderProperty{ nullptr };
|
||||
DependencyProperty SettingsCard::_DescriptionProperty{ nullptr };
|
||||
DependencyProperty SettingsCard::_HeaderIconProperty{ nullptr };
|
||||
DependencyProperty SettingsCard::_ActionIconProperty{ nullptr };
|
||||
DependencyProperty SettingsCard::_ActionIconToolTipProperty{ nullptr };
|
||||
DependencyProperty SettingsCard::_IsClickEnabledProperty{ nullptr };
|
||||
DependencyProperty SettingsCard::_ContentAlignmentProperty{ nullptr };
|
||||
DependencyProperty SettingsCard::_IsActionIconVisibleProperty{ nullptr };
|
||||
|
||||
SettingsCard::SettingsCard()
|
||||
{
|
||||
_InitializeProperties();
|
||||
}
|
||||
|
||||
void SettingsCard::_InitializeProperties()
|
||||
{
|
||||
// Initialize any dependency properties here.
|
||||
// This performs a lazy load on these properties, instead of
|
||||
// initializing them when the DLL loads.
|
||||
if (!_HeaderProperty)
|
||||
{
|
||||
_HeaderProperty =
|
||||
DependencyProperty::Register(
|
||||
L"Header",
|
||||
xaml_typename<IInspectable>(),
|
||||
xaml_typename<Editor::SettingsCard>(),
|
||||
PropertyMetadata{ nullptr,
|
||||
PropertyChangedCallback{ [](auto&& d, auto&&) {
|
||||
const auto& obj = d.as<Editor::SettingsCard>();
|
||||
get_self<SettingsCard>(obj)->_OnHeaderChanged();
|
||||
} } });
|
||||
}
|
||||
if (!_DescriptionProperty)
|
||||
{
|
||||
_DescriptionProperty =
|
||||
DependencyProperty::Register(
|
||||
L"Description",
|
||||
xaml_typename<IInspectable>(),
|
||||
xaml_typename<Editor::SettingsCard>(),
|
||||
PropertyMetadata{ nullptr, PropertyChangedCallback{ [](auto&& d, auto&&) {
|
||||
const auto& obj = d.as<Editor::SettingsCard>();
|
||||
get_self<SettingsCard>(obj)->_OnDescriptionChanged();
|
||||
} } });
|
||||
}
|
||||
if (!_HeaderIconProperty)
|
||||
{
|
||||
_HeaderIconProperty =
|
||||
DependencyProperty::Register(
|
||||
L"HeaderIcon",
|
||||
xaml_typename<Windows::UI::Xaml::Controls::IconElement>(),
|
||||
xaml_typename<Editor::SettingsCard>(),
|
||||
PropertyMetadata{ nullptr, PropertyChangedCallback{ [](auto&& d, auto&&) {
|
||||
const auto& obj = d.as<Editor::SettingsCard>();
|
||||
get_self<SettingsCard>(obj)->_OnHeaderIconChanged();
|
||||
} } });
|
||||
}
|
||||
if (!_ActionIconProperty)
|
||||
{
|
||||
_ActionIconProperty =
|
||||
DependencyProperty::Register(
|
||||
L"ActionIcon",
|
||||
xaml_typename<Windows::UI::Xaml::Controls::IconElement>(),
|
||||
xaml_typename<Editor::SettingsCard>(),
|
||||
PropertyMetadata{ box_value(L"\ue974") });
|
||||
}
|
||||
if (!_ActionIconToolTipProperty)
|
||||
{
|
||||
_ActionIconToolTipProperty =
|
||||
DependencyProperty::Register(
|
||||
L"ActionIconToolTip",
|
||||
xaml_typename<hstring>(),
|
||||
xaml_typename<Editor::SettingsCard>(),
|
||||
PropertyMetadata{ nullptr });
|
||||
}
|
||||
if (!_IsClickEnabledProperty)
|
||||
{
|
||||
_IsClickEnabledProperty =
|
||||
DependencyProperty::Register(
|
||||
L"IsClickEnabled",
|
||||
xaml_typename<bool>(),
|
||||
xaml_typename<Editor::SettingsCard>(),
|
||||
PropertyMetadata{ box_value(false), PropertyChangedCallback{ [](auto&& d, auto&&) {
|
||||
const auto& obj = d.as<Editor::SettingsCard>();
|
||||
get_self<SettingsCard>(obj)->_OnIsClickEnabledChanged();
|
||||
} } });
|
||||
}
|
||||
if (!_ContentAlignmentProperty)
|
||||
{
|
||||
_ContentAlignmentProperty =
|
||||
DependencyProperty::Register(
|
||||
L"ContentAlignment",
|
||||
xaml_typename<Editor::ContentAlignment>(),
|
||||
xaml_typename<Editor::SettingsCard>(),
|
||||
PropertyMetadata{ box_value(Editor::ContentAlignment::Right) });
|
||||
}
|
||||
if (!_IsActionIconVisibleProperty)
|
||||
{
|
||||
_IsActionIconVisibleProperty =
|
||||
DependencyProperty::Register(
|
||||
L"IsActionIconVisible",
|
||||
xaml_typename<bool>(),
|
||||
xaml_typename<Editor::SettingsCard>(),
|
||||
PropertyMetadata{ box_value(true), PropertyChangedCallback{ [](auto&& d, auto&&) {
|
||||
const auto& obj = d.as<Editor::SettingsCard>();
|
||||
get_self<SettingsCard>(obj)->_OnIsActionIconVisibleChanged();
|
||||
} } });
|
||||
}
|
||||
}
|
||||
|
||||
// TODO CARLOS: port these functions over
|
||||
void SettingsCard::_OnHeaderChanged()
|
||||
{
|
||||
}
|
||||
|
||||
void SettingsCard::_OnDescriptionChanged()
|
||||
{
|
||||
}
|
||||
|
||||
void SettingsCard::_OnHeaderIconChanged()
|
||||
{
|
||||
}
|
||||
|
||||
void SettingsCard::_OnIsClickEnabledChanged()
|
||||
{
|
||||
}
|
||||
|
||||
void SettingsCard::_OnIsActionIconVisibleChanged()
|
||||
{
|
||||
}
|
||||
}
|
||||
43
src/cascadia/TerminalSettingsEditor/SettingsCard.h
Normal file
43
src/cascadia/TerminalSettingsEditor/SettingsCard.h
Normal file
@@ -0,0 +1,43 @@
|
||||
//Copyright (c) Microsoft Corporation
|
||||
//Licensed under the MIT license.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SettingsCard.g.h"
|
||||
#include "Utils.h"
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
// TODO CARLOS: SettingsCardT should work. Might be adding MIDL file improperly?
|
||||
//struct SettingsCard : SettingsCardT<SettingsCard>
|
||||
struct SettingsCard : SettingsCard_base<SettingsCard>
|
||||
{
|
||||
public:
|
||||
SettingsCard();
|
||||
|
||||
DEPENDENCY_PROPERTY(Windows::Foundation::IInspectable, Header);
|
||||
DEPENDENCY_PROPERTY(Windows::Foundation::IInspectable, Description);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Controls::IconElement, HeaderIcon);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Controls::IconElement, ActionIcon);
|
||||
DEPENDENCY_PROPERTY(hstring, ActionIconToolTip);
|
||||
DEPENDENCY_PROPERTY(bool, IsClickEnabled);
|
||||
DEPENDENCY_PROPERTY(Editor::ContentAlignment, ContentAlignment);
|
||||
DEPENDENCY_PROPERTY(bool, IsActionIconVisible);
|
||||
|
||||
private:
|
||||
static void _InitializeProperties();
|
||||
|
||||
void _OnHeaderChanged();
|
||||
void _OnDescriptionChanged();
|
||||
void _OnHeaderIconChanged();
|
||||
void _OnIsClickEnabledChanged();
|
||||
void _OnIsActionIconVisibleChanged();
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation
|
||||
{
|
||||
BASIC_FACTORY(SettingsCard);
|
||||
}
|
||||
41
src/cascadia/TerminalSettingsEditor/SettingsCard.idl
Normal file
41
src/cascadia/TerminalSettingsEditor/SettingsCard.idl
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Microsoft.Terminal.Settings.Editor
|
||||
{
|
||||
enum ContentAlignment
|
||||
{
|
||||
Right,
|
||||
Left,
|
||||
Vertical
|
||||
};
|
||||
|
||||
[default_interface] runtimeclass SettingsCard : Windows.UI.Xaml.Controls.Primitives.ButtonBase
|
||||
{
|
||||
SettingsCard();
|
||||
|
||||
IInspectable Header;
|
||||
static Windows.UI.Xaml.DependencyProperty HeaderProperty { get; };
|
||||
|
||||
IInspectable Description;
|
||||
static Windows.UI.Xaml.DependencyProperty DescriptionProperty { get; };
|
||||
|
||||
Windows.UI.Xaml.Controls.IconElement HeaderIcon;
|
||||
static Windows.UI.Xaml.DependencyProperty HeaderIconProperty { get; };
|
||||
|
||||
Windows.UI.Xaml.Controls.IconElement ActionIcon;
|
||||
static Windows.UI.Xaml.DependencyProperty ActionIconProperty { get; };
|
||||
|
||||
String ActionIconToolTip;
|
||||
static Windows.UI.Xaml.DependencyProperty ActionIconToolTipProperty { get; };
|
||||
|
||||
Boolean IsClickEnabled;
|
||||
static Windows.UI.Xaml.DependencyProperty IsClickEnabledProperty { get; };
|
||||
|
||||
ContentAlignment ContentAlignment;
|
||||
static Windows.UI.Xaml.DependencyProperty ContentAlignmentProperty { get; };
|
||||
|
||||
Boolean IsActionIconVisible;
|
||||
static Windows.UI.Xaml.DependencyProperty IsActionIconVisibleProperty { get; };
|
||||
};
|
||||
}
|
||||
1085
src/cascadia/TerminalSettingsEditor/SettingsCard.xaml
Normal file
1085
src/cascadia/TerminalSettingsEditor/SettingsCard.xaml
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user