-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Single commit that adds the whole scratchpad and action
- Loading branch information
1 parent
2dd8f40
commit 1b39db7
Showing
8 changed files
with
146 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
#include "pch.h" | ||
#include "ScratchpadContent.h" | ||
#include "PaneArgs.h" | ||
#include "ScratchpadContent.g.cpp" | ||
|
||
using namespace winrt::Windows::Foundation; | ||
using namespace winrt::Windows::UI::Xaml; | ||
using namespace winrt::Microsoft::Terminal::Settings::Model; | ||
|
||
namespace winrt::TerminalApp::implementation | ||
{ | ||
ScratchpadContent::ScratchpadContent() | ||
{ | ||
_root = winrt::Windows::UI::Xaml::Controls::Grid{}; | ||
_root.VerticalAlignment(VerticalAlignment::Stretch); | ||
_root.HorizontalAlignment(HorizontalAlignment::Stretch); | ||
|
||
auto res = Windows::UI::Xaml::Application::Current().Resources(); | ||
auto bg = res.Lookup(winrt::box_value(L"UnfocusedBorderBrush")); | ||
// _root.Background(Media::SolidColorBrush{ winrt::Windows::UI::Colors::Red() }); | ||
_root.Background(bg.try_as<Media::Brush>()); | ||
|
||
_box = winrt::Windows::UI::Xaml::Controls::TextBox{}; | ||
_box.Margin({ 10, 10, 10, 10 }); | ||
_box.AcceptsReturn(true); | ||
_box.TextWrapping(TextWrapping::Wrap); | ||
_root.Children().Append(_box); | ||
} | ||
|
||
winrt::Windows::UI::Xaml::FrameworkElement ScratchpadContent::GetRoot() | ||
{ | ||
return _root; | ||
} | ||
winrt::Windows::Foundation::Size ScratchpadContent::MinSize() | ||
{ | ||
return { 1, 1 }; | ||
} | ||
void ScratchpadContent::Focus(winrt::Windows::UI::Xaml::FocusState reason) | ||
{ | ||
_box.Focus(reason); | ||
} | ||
void ScratchpadContent::Close() | ||
{ | ||
CloseRequested.raise(*this, nullptr); | ||
} | ||
|
||
NewTerminalArgs ScratchpadContent::GetNewTerminalArgs(const bool /* asContent */) const | ||
{ | ||
return nullptr; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
#pragma once | ||
#include "ScratchpadContent.g.h" | ||
|
||
namespace winrt::TerminalApp::implementation | ||
{ | ||
struct ScratchpadContent : ScratchpadContentT<ScratchpadContent> | ||
{ | ||
ScratchpadContent(); | ||
|
||
winrt::Windows::UI::Xaml::FrameworkElement GetRoot(); | ||
|
||
winrt::Windows::Foundation::Size MinSize(); | ||
void Focus(winrt::Windows::UI::Xaml::FocusState reason = winrt::Windows::UI::Xaml::FocusState::Programmatic); | ||
void Close(); | ||
winrt::Microsoft::Terminal::Settings::Model::NewTerminalArgs GetNewTerminalArgs(const bool asContent) const; | ||
|
||
winrt::hstring Title() { return L"Scratchpad"; } | ||
uint64_t TaskbarState() { return 0; } | ||
uint64_t TaskbarProgress() { return 0; } | ||
bool ReadOnly() { return false; } | ||
|
||
til::typed_event<> CloseRequested; | ||
til::typed_event<winrt::Windows::Foundation::IInspectable, winrt::TerminalApp::BellEventArgs> BellRequested; | ||
til::typed_event<> TitleChanged; | ||
til::typed_event<> TabColorChanged; | ||
til::typed_event<> TaskbarProgressChanged; | ||
til::typed_event<> ReadOnlyChanged; | ||
til::typed_event<> FocusRequested; | ||
|
||
private: | ||
winrt::Windows::UI::Xaml::Controls::Grid _root{ nullptr }; | ||
winrt::Windows::UI::Xaml::Controls::TextBox _box{ nullptr }; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters