Option Strict On
Option Explicit On

Imports System
Imports System.Collections.Generic
Imports System.Collections.ObjectModel
Imports System.Windows.Forms
Imports Nexamas.UI.Architecture
Imports Nexamas.UI.Components.ListPopup
Imports Nexamas.UI.Components.ListRendering
Imports Nexamas.UI.Composition
Imports Nexamas.UI.Controls
Imports Nexamas.UI.FloatRuntime
Imports Nexamas.UI.General
Imports Nexamas.UI.Layout
Imports Nexamas.UI.Rendering
Imports Nexamas.UI.Theming
Imports Nexamas.UI.TextRendering
Imports Nexamas.UI.Values
Imports SkiaSharp

Namespace Nexamas.UI.Components

    Partial Public NotInheritable Class MASComboBox

#Region "State Handling"

        Protected Overrides Function WantsKeyboardFocus() As Boolean
            Return Visible AndAlso Enabled
        End Function

        Protected Overrides Sub OnEnabledChanged()
            MyBase.OnEnabledChanged()

            If Not Me.Enabled Then
                CloseDropdownSafe()
                ResetInputAll()
            End If

            InvalidateVisual()
        End Sub

        Protected Overrides Sub OnVisibleChanged()
            MyBase.OnVisibleChanged()

            If Not Me.Visible Then
                CloseDropdownSafe()
                ResetInputAll()
            End If

            InvalidateVisual()
        End Sub

        Protected Overrides Sub OnGotKeyboardFocus()
            MyBase.OnGotKeyboardFocus()
            InvalidateVisual()
        End Sub

        Protected Overrides Sub OnLostKeyboardFocus()
            MyBase.OnLostKeyboardFocus()

            If _isDropdownOpen Then
                CloseDropdownSafe()
                Return
            End If

            _pressed = False

            StopPressPulse(clearPressed:=False)

            InvalidateVisual()
        End Sub

#End Region

    End Class

End Namespace
