// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

namespace Microsoft.Terminal.TerminalControl
{
    delegate void TitleChangedEventArgs(String newTitle);
    delegate void ConnectionClosedEventArgs();
    delegate void ScrollPositionChangedEventArgs(Int32 viewTop, Int32 viewHeight, Int32 bufferLength);

    runtimeclass CopyToClipboardEventArgs
    {
        String Text { get; };
        String Html { get; };
    }

    runtimeclass PasteFromClipboardEventArgs
    {
        void HandleClipboardData(String data);
    }

    [default_interface] runtimeclass TermControl : Windows.UI.Xaml.Controls.UserControl
    {
        TermControl();
        TermControl(Microsoft.Terminal.Settings.IControlSettings settings, Microsoft.Terminal.TerminalConnection.ITerminalConnection connection);

        static Windows.Foundation.Point GetProposedDimensions(Microsoft.Terminal.Settings.IControlSettings settings, UInt32 dpi);

        void UpdateSettings(Microsoft.Terminal.Settings.IControlSettings newSettings);

        event TitleChangedEventArgs TitleChanged;
        event ConnectionClosedEventArgs ConnectionClosed;
        event Windows.Foundation.TypedEventHandler<TermControl, CopyToClipboardEventArgs> CopyToClipboard;
        event Windows.Foundation.TypedEventHandler<TermControl, PasteFromClipboardEventArgs> PasteFromClipboard;

        String Title { get; };

        Boolean CopySelectionToClipboard(Boolean trimTrailingWhitespace);
        void PasteTextFromClipboard();
        void Close();
        Boolean ShouldCloseOnExit { get; };
        Windows.Foundation.Size CharacterDimensions { get; };
        Windows.Foundation.Size MinimumSize { get; };

        void ScrollViewport(Int32 viewTop);
        void KeyboardScrollViewport(Int32 viewTop);
        Int32 GetScrollOffset();
        Int32 GetViewHeight();
        event ScrollPositionChangedEventArgs ScrollPositionChanged;

        void AdjustFontSize(Int32 fontSizeDelta);
    }
}
