Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Tab tooltip explicitly #8298

Merged
8 commits merged into from Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/cascadia/TerminalApp/TerminalTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ namespace winrt::TerminalApp::implementation
tab->SetTabText(title);
}
});

// Use our header control as the TabViewItem's header
TabViewItem().Header(_headerControl);
}
Expand All @@ -71,6 +70,13 @@ namespace winrt::TerminalApp::implementation
_RecalculateAndApplyTabColor();
}

void TerminalTab::_SetToolTip(const winrt::hstring& tabTitle)
{
WUX::Controls::ToolTip toolTip{};
toolTip.Content(winrt::box_value(tabTitle));
WUX::Controls::ToolTipService::SetToolTip(TabViewItem(), toolTip);
}

// Method Description:
// - Returns nullptr if no children of this tab were the last control to be
// focused, or the TermControl that _was_ the last control to be focused (if
Expand Down Expand Up @@ -231,6 +237,7 @@ namespace winrt::TerminalApp::implementation

// Update the control to reflect the changed title
_headerControl.Title(activeTitle);
_SetToolTip(activeTitle);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/TerminalApp/TerminalTab.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ namespace winrt::TerminalApp::implementation

void _MakeTabViewItem();

void _SetToolTip(const winrt::hstring& tabTitle);

void _CreateContextMenu() override;

void _RefreshVisualState();
Expand Down