Prototype: get some tooltips back
This commit is contained in:
parent
a00e9edecc
commit
953620669d
|
@ -20,6 +20,7 @@ namespace winrt::TerminalApp::implementation
|
|||
MinMaxCloseControl::MinMaxCloseControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
_MinimizeToolTip = RS_(L"WindowMinimizeButtonToolTipText");
|
||||
}
|
||||
|
||||
// These event handlers simply forward each buttons click events up to the
|
||||
|
@ -104,16 +105,45 @@ namespace winrt::TerminalApp::implementation
|
|||
VisualStateManager::GoToState(MinimizeButton(), L"PointerOver", false);
|
||||
VisualStateManager::GoToState(MaximizeButton(), L"Normal", false);
|
||||
VisualStateManager::GoToState(CloseButton(), L"Normal", false);
|
||||
if (auto tt{ Controls::ToolTipService::GetToolTip(MinimizeButton()) })
|
||||
{
|
||||
if (auto tooltip{ tt.try_as<Controls::ToolTip>() })
|
||||
{
|
||||
tooltip.IsOpen(true);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case CaptionButton::Maximize:
|
||||
VisualStateManager::GoToState(MinimizeButton(), L"Normal", false);
|
||||
VisualStateManager::GoToState(MaximizeButton(), L"PointerOver", false);
|
||||
VisualStateManager::GoToState(CloseButton(), L"Normal", false);
|
||||
if (auto tt{ Controls::ToolTipService::GetToolTip(MaximizeButton()) })
|
||||
{
|
||||
if (auto tooltip{ tt.try_as<Controls::ToolTip>() })
|
||||
{
|
||||
tooltip.IsOpen(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CaptionButton::Close:
|
||||
VisualStateManager::GoToState(MinimizeButton(), L"Normal", false);
|
||||
VisualStateManager::GoToState(MaximizeButton(), L"Normal", false);
|
||||
VisualStateManager::GoToState(CloseButton(), L"PointerOver", false);
|
||||
if (auto tt{ Controls::ToolTipService::GetToolTip(CloseButton()) })
|
||||
{
|
||||
if (auto tooltip{ tt.try_as<Controls::ToolTip>() })
|
||||
{
|
||||
tooltip.IsOpen(true);
|
||||
}
|
||||
else if (auto s{winrt::unbox_value<winrt::hstring>(tt)}; !s.empty())
|
||||
{
|
||||
s;
|
||||
int a = 0;
|
||||
a++;
|
||||
a;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@ namespace winrt::TerminalApp::implementation
|
|||
void _CloseClick(winrt::Windows::Foundation::IInspectable const& sender,
|
||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||
|
||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, MinimizeToolTip, _PropertyChangedHandlers);
|
||||
|
||||
TYPED_EVENT(MinimizeClick, TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs);
|
||||
TYPED_EVENT(MaximizeClick, TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs);
|
||||
TYPED_EVENT(CloseClick, TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs);
|
||||
|
|
|
@ -5,7 +5,8 @@ import "TitlebarControl.idl";
|
|||
|
||||
namespace TerminalApp
|
||||
{
|
||||
[default_interface] runtimeclass MinMaxCloseControl : Windows.UI.Xaml.Controls.StackPanel
|
||||
[default_interface] runtimeclass MinMaxCloseControl : Windows.UI.Xaml.Controls.StackPanel,
|
||||
Windows.UI.Xaml.Data.INotifyPropertyChanged
|
||||
{
|
||||
MinMaxCloseControl();
|
||||
|
||||
|
@ -15,6 +16,8 @@ namespace TerminalApp
|
|||
void PressButton(CaptionButton button);
|
||||
void ReleaseButtons();
|
||||
|
||||
String MinimizeToolTip { get; };
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<MinMaxCloseControl, Windows.UI.Xaml.RoutedEventArgs> MinimizeClick;
|
||||
event Windows.Foundation.TypedEventHandler<MinMaxCloseControl, Windows.UI.Xaml.RoutedEventArgs> MaximizeClick;
|
||||
event Windows.Foundation.TypedEventHandler<MinMaxCloseControl, Windows.UI.Xaml.RoutedEventArgs> CloseClick;
|
||||
|
|
|
@ -220,7 +220,7 @@
|
|||
</StackPanel.Resources>
|
||||
|
||||
<Button x:Name="MinimizeButton"
|
||||
x:Uid="WindowMinimizeButton"
|
||||
x:Uid="MinimizeButton"
|
||||
Width="46.0"
|
||||
Height="{StaticResource CaptionButtonHeightWindowed}"
|
||||
MinWidth="46.0"
|
||||
|
@ -232,9 +232,14 @@
|
|||
<x:String x:Key="CaptionButtonPath">M 0 0 H 10</x:String>
|
||||
</ResourceDictionary>
|
||||
</Button.Resources>
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip>
|
||||
<TextBlock x:Uid="WindowMinimizeButtonToolTip" />
|
||||
</ToolTip>
|
||||
</ToolTipService.ToolTip>
|
||||
</Button>
|
||||
<Button x:Name="MaximizeButton"
|
||||
x:Uid="WindowMaximizeButton"
|
||||
x:Uid="MaximizeButton"
|
||||
Width="46.0"
|
||||
Height="{StaticResource CaptionButtonHeightWindowed}"
|
||||
MinWidth="46.0"
|
||||
|
@ -256,7 +261,7 @@
|
|||
</ToolTipService.ToolTip>
|
||||
</Button>
|
||||
<Button x:Name="CloseButton"
|
||||
x:Uid="WindowCloseButton"
|
||||
x:Uid="CloseButton"
|
||||
Width="46.0"
|
||||
Height="{StaticResource CaptionButtonHeightWindowed}"
|
||||
MinWidth="46.0"
|
||||
|
@ -309,5 +314,10 @@
|
|||
<x:String x:Key="CaptionButtonPath">M 0 0 L 10 10 M 10 0 L 0 10</x:String>
|
||||
</ResourceDictionary>
|
||||
</Button.Resources>
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip>
|
||||
<TextBlock x:Uid="WindowCloseButtonToolTip" />
|
||||
</ToolTip>
|
||||
</ToolTipService.ToolTip>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
|
|
@ -411,6 +411,9 @@
|
|||
<data name="WindowCloseButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
<data name="WindowCloseButtonToolTip.Text" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
<data name="WindowMaximizeButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Maximize</value>
|
||||
</data>
|
||||
|
@ -420,6 +423,9 @@
|
|||
<data name="WindowMinimizeButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Minimize</value>
|
||||
</data>
|
||||
<data name="WindowMinimizeButtonToolTipText" xml:space="preserve">
|
||||
<value>Minimize</value>
|
||||
</data>
|
||||
<data name="AboutDialog.Title" xml:space="preserve">
|
||||
<value>About</value>
|
||||
</data>
|
||||
|
|
Loading…
Reference in a new issue