|
| 1 | +// Copyright (c) Microsoft Corporation. |
| 2 | +// Licensed under the MIT license. |
| 3 | + |
| 4 | +#include "pch.h" |
| 5 | +#include "ScratchpadContent.h" |
| 6 | + |
| 7 | +using namespace winrt::Windows::Foundation; |
| 8 | +using namespace winrt::Windows::UI::Xaml; |
| 9 | +using namespace winrt::Microsoft::Terminal::Settings::Model; |
| 10 | + |
| 11 | +namespace winrt::TerminalApp::implementation |
| 12 | +{ |
| 13 | + ScratchpadContent::ScratchpadContent() |
| 14 | + { |
| 15 | + _root = winrt::Windows::UI::Xaml::Controls::Grid{}; |
| 16 | + // Vertical and HorizontalAlignment are Stretch by default |
| 17 | + |
| 18 | + auto res = Windows::UI::Xaml::Application::Current().Resources(); |
| 19 | + auto bg = res.Lookup(winrt::box_value(L"UnfocusedBorderBrush")); |
| 20 | + _root.Background(bg.try_as<Media::Brush>()); |
| 21 | + |
| 22 | + _box = winrt::Windows::UI::Xaml::Controls::TextBox{}; |
| 23 | + _box.Margin({ 10, 10, 10, 10 }); |
| 24 | + _box.AcceptsReturn(true); |
| 25 | + _box.TextWrapping(TextWrapping::Wrap); |
| 26 | + _root.Children().Append(_box); |
| 27 | + } |
| 28 | + |
| 29 | + winrt::Windows::UI::Xaml::FrameworkElement ScratchpadContent::GetRoot() |
| 30 | + { |
| 31 | + return _root; |
| 32 | + } |
| 33 | + winrt::Windows::Foundation::Size ScratchpadContent::MinimumSize() |
| 34 | + { |
| 35 | + return { 1, 1 }; |
| 36 | + } |
| 37 | + void ScratchpadContent::Focus(winrt::Windows::UI::Xaml::FocusState reason) |
| 38 | + { |
| 39 | + _box.Focus(reason); |
| 40 | + } |
| 41 | + void ScratchpadContent::Close() |
| 42 | + { |
| 43 | + CloseRequested.raise(*this, nullptr); |
| 44 | + } |
| 45 | + |
| 46 | + NewTerminalArgs ScratchpadContent::GetNewTerminalArgs(const bool /* asContent */) const |
| 47 | + { |
| 48 | + return nullptr; |
| 49 | + } |
| 50 | +} |
0 commit comments