3cf7677d17
As mentioned in https://github.com/microsoft/terminal/issues/9354#issuecomment-790034728 `GETSET_SETTING` is too visually similar to `GETSET_PROPERTY`, but with a _VERY_ different meaning. I think that merely changing the name of the macro would make it harder for us to make this mistake again.
46 lines
1.5 KiB
C++
46 lines
1.5 KiB
C++
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
|
|
#pragma once
|
|
|
|
#include "HighlightedTextControl.h"
|
|
#include "FilteredCommand.g.h"
|
|
#include "../../cascadia/inc/cppwinrt_utils.h"
|
|
|
|
// fwdecl unittest classes
|
|
namespace TerminalAppLocalTests
|
|
{
|
|
class FilteredCommandTests;
|
|
};
|
|
|
|
namespace winrt::TerminalApp::implementation
|
|
{
|
|
struct FilteredCommand : FilteredCommandT<FilteredCommand>
|
|
{
|
|
FilteredCommand() = default;
|
|
FilteredCommand(winrt::TerminalApp::PaletteItem const& item);
|
|
|
|
void UpdateFilter(winrt::hstring const& filter);
|
|
|
|
static int Compare(winrt::TerminalApp::FilteredCommand const& first, winrt::TerminalApp::FilteredCommand const& second);
|
|
|
|
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
|
WINRT_OBSERVABLE_PROPERTY(winrt::TerminalApp::PaletteItem, Item, _PropertyChangedHandlers, nullptr);
|
|
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Filter, _PropertyChangedHandlers);
|
|
WINRT_OBSERVABLE_PROPERTY(winrt::TerminalApp::HighlightedText, HighlightedName, _PropertyChangedHandlers);
|
|
WINRT_OBSERVABLE_PROPERTY(int, Weight, _PropertyChangedHandlers);
|
|
|
|
private:
|
|
winrt::TerminalApp::HighlightedText _computeHighlightedName();
|
|
int _computeWeight();
|
|
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _itemChangedRevoker;
|
|
|
|
friend class TerminalAppLocalTests::FilteredCommandTests;
|
|
};
|
|
}
|
|
|
|
namespace winrt::TerminalApp::factory_implementation
|
|
{
|
|
BASIC_FACTORY(FilteredCommand);
|
|
}
|