-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Pane to be able to host non-terminal content (#16170)
Instead of `Pane` hosting a `TermControl` directly, it now hosts an `IPaneContent`. This is an abstraction between the TermControl and the pane itself, to allow for arbitrary implementations of `IPaneContent`, with things that might not be terminals. ## References and Relevant Issues * #997 * #1000 ## Detailed Description of the Pull Request / Additional comments This PR by itself doesn't do much. It's just a refactoring. - It doesn't actually add any other types of pane content. - It overall just tries to move code whenever possible, with as little refactoring as possible. There are some patterns from before that don't super scale well to other types of pane content (think: the `xyzChanged` events on `IPaneContent`). - There's a few remaining places where Pane is explicitly checking if its content is a terminal. We probably shouldn't, but meh There are two follow-up PRs to this PR: * #16171 * #16172 In addition, there's more work to be done after these merge: * TODO! issue number for "Replace `IPaneContent::xyzChanged` with `PropertyChanged` events" * TODO! issue number for "Re-write state restoration so panes don't produce `NewTerminalArgs`" ## Validation Steps Performed * It still launches * It still works * Broadcasting still works * The weird restart connection thing from #16001 still works ## PR Checklist - [x] Closes #997 ## other PRs * #16170 <-- you are here * #16171 * #16172
- Loading branch information
1 parent
2ee7783
commit 08dc346
Showing
16 changed files
with
925 additions
and
581 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
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,52 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
namespace TerminalApp | ||
{ | ||
|
||
runtimeclass BellEventArgs | ||
{ | ||
Boolean FlashTaskbar { get; }; | ||
}; | ||
|
||
interface IPaneContent | ||
{ | ||
Windows.UI.Xaml.FrameworkElement GetRoot(); | ||
|
||
Windows.Foundation.Size MinimumSize { get; }; | ||
|
||
String Title { get; }; | ||
UInt64 TaskbarState { get; }; | ||
UInt64 TaskbarProgress { get; }; | ||
Boolean ReadOnly { get; }; | ||
|
||
Microsoft.Terminal.Settings.Model.NewTerminalArgs GetNewTerminalArgs(Boolean asContent); | ||
|
||
void Focus(Windows.UI.Xaml.FocusState reason); | ||
|
||
void Close(); | ||
|
||
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> CloseRequested; | ||
|
||
event Windows.Foundation.TypedEventHandler<Object, Object> ConnectionStateChanged; | ||
event Windows.Foundation.TypedEventHandler<IPaneContent, BellEventArgs> BellRequested; | ||
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> TitleChanged; | ||
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> TabColorChanged; | ||
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> TaskbarProgressChanged; | ||
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> ReadOnlyChanged; | ||
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> FocusRequested; | ||
}; | ||
|
||
|
||
enum PaneSnapDirection | ||
{ | ||
Width, | ||
Height | ||
}; | ||
|
||
interface ISnappable | ||
{ | ||
Single SnapDownToGrid(PaneSnapDirection direction, Single sizeToSnap); | ||
Windows.Foundation.Size GridUnitSize { get; }; | ||
}; | ||
} |
Oops, something went wrong.