## Summary of the Pull Request We already have "splitHorizontal" and "splitVertical", but those will both be deprecated in favor of "splitPane" with arguments. Currently, there's one argument: "style", which is one of "vertical" or "horizontal." ## References This is being done in pursuit of supporting #607 and #998. I don't really want to lob #998 in with this one, since both that and this are hefty enough PRs even as they are. (I have a branch for #998, but it needs this first) This will probably conflict with #3658 ## PR Checklist * [ ] Doesn't actually close anything, only enables #998 * [x] I work here * [ ] Tests added/passed - yea okay no excuses here * [x] Requires documentation to be updated ## Validation Steps Performed Added new keybindings with the args - works Tried the old keybindings without the args - still works --------------------------------------- * Add a 'splitPane' keybinding that can be used for splitting a pane either vertically or horizontally * Update documentation too * Good lord this is important * Add a test too, though I have no idea if it works * "style" -> "split" * pr comments from carlos
55 lines
2.1 KiB
C++
55 lines
2.1 KiB
C++
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
|
|
#pragma once
|
|
#include <winrt/Microsoft.UI.Xaml.Controls.h>
|
|
#include "Pane.h"
|
|
|
|
class Tab
|
|
{
|
|
public:
|
|
Tab(const GUID& profile, const winrt::Microsoft::Terminal::TerminalControl::TermControl& control);
|
|
|
|
winrt::Microsoft::UI::Xaml::Controls::TabViewItem GetTabViewItem();
|
|
winrt::Windows::UI::Xaml::UIElement GetRootElement();
|
|
winrt::Microsoft::Terminal::TerminalControl::TermControl GetActiveTerminalControl() const;
|
|
std::optional<GUID> GetFocusedProfile() const noexcept;
|
|
|
|
bool IsFocused() const noexcept;
|
|
void SetFocused(const bool focused);
|
|
|
|
void Scroll(const int delta);
|
|
|
|
bool CanSplitPane(winrt::TerminalApp::SplitState splitType);
|
|
void SplitPane(winrt::TerminalApp::SplitState splitType, const GUID& profile, winrt::Microsoft::Terminal::TerminalControl::TermControl& control);
|
|
|
|
void UpdateIcon(const winrt::hstring iconPath);
|
|
|
|
void ResizeContent(const winrt::Windows::Foundation::Size& newSize);
|
|
void ResizePane(const winrt::TerminalApp::Direction& direction);
|
|
void NavigateFocus(const winrt::TerminalApp::Direction& direction);
|
|
|
|
void UpdateSettings(const winrt::Microsoft::Terminal::Settings::TerminalSettings& settings, const GUID& profile);
|
|
winrt::hstring GetActiveTitle() const;
|
|
void SetTabText(const winrt::hstring& text);
|
|
|
|
void ClosePane();
|
|
|
|
WINRT_CALLBACK(Closed, winrt::Windows::Foundation::EventHandler<winrt::Windows::Foundation::IInspectable>);
|
|
DECLARE_EVENT(ActivePaneChanged, _ActivePaneChangedHandlers, winrt::delegate<>);
|
|
|
|
private:
|
|
std::shared_ptr<Pane> _rootPane{ nullptr };
|
|
std::shared_ptr<Pane> _activePane{ nullptr };
|
|
winrt::hstring _lastIconPath{};
|
|
|
|
bool _focused{ false };
|
|
winrt::Microsoft::UI::Xaml::Controls::TabViewItem _tabViewItem{ nullptr };
|
|
|
|
void _MakeTabViewItem();
|
|
void _Focus();
|
|
|
|
void _AttachEventHandlersToControl(const winrt::Microsoft::Terminal::TerminalControl::TermControl& control);
|
|
void _AttachEventHandlersToPane(std::shared_ptr<Pane> pane);
|
|
};
|