-
Notifications
You must be signed in to change notification settings - Fork 8.5k
/
Copy pathFilteredCommand.h
47 lines (36 loc) · 1.55 KB
/
FilteredCommand.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#pragma once
#include "HighlightedTextControl.h"
#include "FilteredCommand.g.h"
// fwdecl unittest classes
namespace TerminalAppLocalTests
{
class FilteredCommandTests;
};
namespace winrt::TerminalApp::implementation
{
struct FilteredCommand : FilteredCommandT<FilteredCommand>
{
FilteredCommand() = default;
FilteredCommand(const winrt::TerminalApp::PaletteItem& item);
virtual void UpdateFilter(const winrt::hstring& filter);
static int Compare(const winrt::TerminalApp::FilteredCommand& first, const winrt::TerminalApp::FilteredCommand& second);
til::property_changed_event PropertyChanged;
WINRT_OBSERVABLE_PROPERTY(winrt::TerminalApp::PaletteItem, Item, PropertyChanged.raise, nullptr);
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Filter, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(winrt::TerminalApp::HighlightedText, HighlightedName, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(int, Weight, PropertyChanged.raise);
protected:
void _constructFilteredCommand(const winrt::TerminalApp::PaletteItem& item);
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);
}