terminal/src/cascadia/TerminalSettingsEditor/MainPage.idl
Dustin L. Howett 8f79f7c4c8
Propagate the hosting HWND to the new IFileDialogs (#9789)
This is required to maintain the modality of the dialogs, which we lost
when we moved from Pickers to IFileDialog. The HWND hosting Window API
we dreamed up is incompatible with IModalDialog, because IModalDialog
requires the HWND immediately upon `Show`. We're smuggling it in a
uint64, as is tradition.

zadjii-msft noticed this in #9760.
2021-04-12 16:55:51 +00:00

28 lines
1.2 KiB
Plaintext

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
namespace Microsoft.Terminal.Settings.Editor
{
// Due to a XAML Compiler bug, it is hard for us to propagate an HWND into a XAML-using runtimeclass.
// To work around that, we'll only propagate the HWND (when we need to) into the settings' toplevel page
// and use IHostedInWindow to hide the implementation detail where we use IInitializeWithWindow (shobjidl_core)
// https://github.com/microsoft/microsoft-ui-xaml/issues/3331
interface IHostedInWindow
{
Boolean TryPropagateHostingWindow(IInspectable i);
UInt64 GetHostingWindow();
}
[default_interface] runtimeclass MainPage : Windows.UI.Xaml.Controls.Page, IHostedInWindow
{
MainPage(Microsoft.Terminal.Settings.Model.CascadiaSettings settings);
void UpdateSettings(Microsoft.Terminal.Settings.Model.CascadiaSettings settings);
event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Settings.Model.SettingsTarget> OpenJson;
// Due to the aforementioned bug, we can't use IInitializeWithWindow _here_ either.
// Let's just smuggle the HWND in as a UInt64 :|
void SetHostingWindow(UInt64 window);
}
}