Imports System.ComponentModel
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Drawing
Imports DevExpress.XtraEditors.Registrator
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraEditors.ViewInfo

Public Class RepositoryItemTokenEditEx
    Inherits RepositoryItemTokenEdit

    ' The unique name for the custom editor
    Public Const CustomEditName As String = "TokenEditEx"

    Shared Sub New()
        RegisterTokenEditEx()
    End Sub

    ' Return the unique name
    Public Overrides ReadOnly Property EditorTypeName() As String
        Get
            Return CustomEditName
        End Get
    End Property

    Public Shared Sub RegisterTokenEditEx()
        EditorRegistrationInfo.Default.Editors.Add(
            New EditorClassInfo(CustomEditName,
                                GetType(TokenEditEx),
                                GetType(RepositoryItemTokenEditEx),
                                GetType(TokenEditViewInfoEx),
                                New TokenEditPainter,
                                True))
    End Sub
End Class

Public Class TokenEditViewInfoEx
    Inherits TokenEditViewInfo

    Const InnerMargin = 3

    Public Sub New(item As RepositoryItem)
        MyBase.New(item)
    End Sub

    Protected Overrides ReadOnly Property IndentBetweenItems As Integer
        Get
            Return InnerMargin
        End Get
    End Property

    Protected Overrides ReadOnly Property ContentRectMargin As Integer
        Get
            Return InnerMargin
        End Get
    End Property

    Protected Overrides ReadOnly Property IndentBetweenRows As Integer
        Get
            Return InnerMargin
        End Get
    End Property


End Class


<ToolboxItem(True)>
Public Class TokenEditEx
    Inherits TokenEdit

    Shared Sub New()
        RepositoryItemTokenEditEx.RegisterTokenEditEx()
    End Sub



    Public Overrides ReadOnly Property EditorTypeName() As String
        Get
            Return RepositoryItemTokenEditEx.CustomEditName
        End Get
    End Property

    <DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
    Public Shadows ReadOnly Property Properties As RepositoryItemTokenEditEx
        Get
            Return TryCast(MyBase.Properties, RepositoryItemTokenEditEx)
        End Get
    End Property
End Class
