Option Strict On
Option Explicit On

Imports Nexamas.UI.Theming
Imports SkiaSharp

Namespace Nexamas.UI.FloatRuntime

    ''' <summary>
    ''' Carries FloatRuntime pointer-move ownership separately from visual mutation.
    ''' </summary>
    ''' <remarks>
    ''' A Float can legitimately own/swallow a pointer move without requiring a new Skia frame.
    ''' This contract prevents hover-stable menus and list popups from invalidating the whole host
    ''' for every WM_MOUSEMOVE while preserving modal/input ownership semantics.
    ''' </remarks>
    Friend NotInheritable Class MASFloatPointerMoveRoutingResult

        Private Shared ReadOnly _notHandled As New MASFloatPointerMoveRoutingResult(False, False)
        Private Shared ReadOnly _handledWithoutVisualChange As New MASFloatPointerMoveRoutingResult(True, False)
        Private Shared ReadOnly _handledWithVisualChange As New MASFloatPointerMoveRoutingResult(True, True)

        Private Sub New(handled As Boolean, visualChanged As Boolean)
            Me.Handled = handled
            Me.VisualChanged = visualChanged
        End Sub

        Friend ReadOnly Property Handled As Boolean
        Friend ReadOnly Property VisualChanged As Boolean

        Friend Shared Function NotHandled() As MASFloatPointerMoveRoutingResult
            Return _notHandled
        End Function

        Friend Shared Function HandledResult(visualChanged As Boolean) As MASFloatPointerMoveRoutingResult
            If visualChanged Then Return _handledWithVisualChange
            Return _handledWithoutVisualChange
        End Function

    End Class

    ''' <summary>
    ''' Optional Float content contract for precise pointer-move invalidation.
    ''' </summary>
    ''' <remarks>
    ''' Existing Float content can continue implementing IMASFloatRoutedInputContent only. Content that
    ''' implements this interface promises to return True only when pointer movement changed a rendered
    ''' visual state such as hover row, scrollbar hover/drag, submenu path, or close affordance state.
    ''' </remarks>
    Friend Interface IMASFloatPointerMoveChangeAwareContent

        Function PointerMoveFloatVisualChanged(ctx As MASThemeContext, ptPx As SKPoint) As Boolean

    End Interface

End Namespace
