terminal/src/cascadia/TerminalControl/TermControl.idl
Mike Griese d749df70ed
Rename Microsoft.Terminal.TerminalControl to .Control; Split into dll & lib (#9472)
**BE NOT AFRAID**. I know that there's 107 files in this PR, but almost
all of it is just find/replacing `TerminalControl` with `Control`.

This is the start of the work to move TermControl into multiple pieces,
for #5000. The PR starts this work by:
* Splits `TerminalControl` into separate lib and dll projects. We'll
  want control tests in the future, and for that, we'll need a lib.
* Moves `ICoreSettings` back into the `Microsoft.Terminal.Core`
  namespace. We'll have other types in there soon too. 
  * I could not tell you why this works suddenly. New VS versions? New
    cppwinrt version? Maybe we're just better at dealing with mdmerge
    bugs these days.
* RENAMES  `Microsoft.Terminal.TerminalControl` to
  `Microsoft.Terminal.Control`. This touches pretty much every file in
  the sln. Sorry about that (not sorry). 

An upcoming PR will move much of the logic in TermControl into a new
`ControlCore` class that we'll add in `Microsoft.Terminal.Core`.
`ControlCore` will then be unittest-able in the
`UnitTests_TerminalCore`, which will help prevent regressions like #9455 

## Detailed Description of the Pull Request / Additional comments
You're really gonna want to clean the sln first, then merge this into
your branch, then rebuild. It's very likely that old winmds will get
left behind. If you see something like 

```
Error    MDM2007    Cannot create type
Microsoft.Terminal.TerminalControl.KeyModifiers in read-only metadata
file Microsoft.Terminal.TerminalControl.
```

then that's what happened to you.
2021-03-17 20:47:24 +00:00

128 lines
5 KiB
Plaintext

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import "IMouseWheelListener.idl";
import "IControlSettings.idl";
namespace Microsoft.Terminal.Control
{
delegate void TitleChangedEventArgs(String newTitle);
delegate void FontSizeChangedEventArgs(Int32 width, Int32 height, Boolean isInitialChange);
delegate void ScrollPositionChangedEventArgs(Int32 viewTop, Int32 viewHeight, Int32 bufferLength);
// C++/winrt makes it difficult to share this idl between two projects,
// Instead, we just pin the uuid and include it in both TermControl and App
// If you update this one, please update TerminalApp\IDirectKeyListener.idl.
// If you change this interface, please update the guid.
// If you press F7 or Alt and get a runtime error, go make sure both copies are the same.
[uuid("0ddf4edc-3fda-4dee-97ca-a417ee3dd510")] interface IDirectKeyListener {
Boolean OnDirectKeyEvent(UInt32 vkey, UInt8 scanCode, Boolean down);
};
[flags]
enum CopyFormat
{
HTML = 0x1,
RTF = 0x2,
All = 0xffffffff
};
runtimeclass CopyToClipboardEventArgs
{
String Text { get; };
String Html { get; };
String Rtf { get; };
Windows.Foundation.IReference<CopyFormat> Formats { get; };
}
runtimeclass PasteFromClipboardEventArgs
{
void HandleClipboardData(String data);
}
runtimeclass OpenHyperlinkEventArgs
{
String Uri { get; };
}
enum NoticeLevel
{
Debug = 10,
Info = 20,
Warning = 30,
Error = 40,
};
runtimeclass NoticeEventArgs
{
NoticeLevel Level { get; };
String Message { get; };
}
[default_interface] runtimeclass TermControl : Windows.UI.Xaml.Controls.UserControl, IDirectKeyListener, IMouseWheelListener
{
TermControl(Microsoft.Terminal.Control.IControlSettings settings, Microsoft.Terminal.TerminalConnection.ITerminalConnection connection);
static Windows.Foundation.Size GetProposedDimensions(Microsoft.Terminal.Control.IControlSettings settings, UInt32 dpi);
void UpdateSettings();
Microsoft.Terminal.Control.IControlSettings Settings { get; };
event TitleChangedEventArgs TitleChanged;
event FontSizeChangedEventArgs FontSizeChanged;
event Windows.Foundation.TypedEventHandler<TermControl, CopyToClipboardEventArgs> CopyToClipboard;
event Windows.Foundation.TypedEventHandler<TermControl, PasteFromClipboardEventArgs> PasteFromClipboard;
event Windows.Foundation.TypedEventHandler<TermControl, OpenHyperlinkEventArgs> OpenHyperlink;
event Windows.Foundation.TypedEventHandler<TermControl, Object> SetTaskbarProgress;
event Windows.Foundation.TypedEventHandler<TermControl, NoticeEventArgs> RaiseNotice;
event Windows.Foundation.TypedEventHandler<Object, Object> WarningBell;
event Windows.Foundation.TypedEventHandler<Object, Object> HidePointerCursor;
event Windows.Foundation.TypedEventHandler<Object, Object> RestorePointerCursor;
event Windows.Foundation.TypedEventHandler<TermControl, Windows.UI.Xaml.RoutedEventArgs> Initialized;
// This is an event handler forwarder for the underlying connection.
// We expose this and ConnectionState here so that it might eventually be data bound.
event Windows.Foundation.TypedEventHandler<TermControl, IInspectable> ConnectionStateChanged;
Microsoft.Terminal.TerminalConnection.ConnectionState ConnectionState { get; };
String Title { get; };
Boolean CopySelectionToClipboard(Boolean singleLine, Windows.Foundation.IReference<CopyFormat> formats);
void PasteTextFromClipboard();
void Close();
Windows.Foundation.Size CharacterDimensions { get; };
Windows.Foundation.Size MinimumSize { get; };
Single SnapDimensionToGrid(Boolean widthOrHeight, Single dimension);
void ScrollViewport(Int32 viewTop);
Int32 GetScrollOffset();
Int32 GetViewHeight();
event ScrollPositionChangedEventArgs ScrollPositionChanged;
void CreateSearchBoxControl();
void SearchMatch(Boolean goForward);
void AdjustFontSize(Int32 fontSizeDelta);
void ResetFontSize();
void ToggleShaderEffects();
void SendInput(String input);
void TaskbarProgressChanged();
UInt64 TaskbarState { get; };
UInt64 TaskbarProgress { get; };
String WorkingDirectory { get; };
Windows.Foundation.IReference<Windows.UI.Color> TabColor { get; };
event Windows.Foundation.TypedEventHandler<Object, Object> TabColorChanged;
Boolean ReadOnly { get; };
void ToggleReadOnly();
event Windows.Foundation.TypedEventHandler<Object, Object> ReadOnlyChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> FocusFollowMouseRequested;
}
}