Click here to Skip to main content
15,895,142 members
Articles / Programming Languages / Visual Basic

Mathemathics Framework

Rate me:
Please Sign up or sign in to vote.
4.76/5 (56 votes)
16 Sep 2008CPOL6 min read 75.4K   6.2K   171  
.NET Mathematical Framework
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
'Imports System.Windows.Forms.cmp



<CLSCompliant(True)> _
Public Class BVToolBarCollectionBase
    'Inherits bvCollectionBase
    Implements ICollection
    Implements IEnumerable
    Implements IList

    Protected tlbar As BVToolBar
    Protected Alist As ArrayList
    Protected TEnum As BVToolBarEnumerator

    Public Event Change(ByVal sender As Object, ByVal e As EventArgs)

    Public Sub New(ByVal owner As BVToolBar)
        tlbar = owner
        Alist = New ArrayList
        TEnum = New BVToolBarEnumerator(Me.Alist)
    End Sub

#Region "Properties"

    Public Property Parent() As BVToolBar
        Get
            Return Me.tlbar
        End Get
        Set(ByVal Value As BVToolBar)
            Me.tlbar = Value
        End Set
    End Property

    Public ReadOnly Property Count() As Integer Implements System.Collections.ICollection.Count
        Get
            Return Alist.Count
        End Get
    End Property

    Public ReadOnly Property IsSynchronized() As Boolean Implements System.Collections.ICollection.IsSynchronized
        Get
            Return False
        End Get
    End Property

    Public ReadOnly Property SyncRoot() As Object Implements System.Collections.ICollection.SyncRoot
        Get
            Return Nothing
        End Get
    End Property

    Public ReadOnly Property IsFixedSize() As Boolean Implements System.Collections.IList.IsFixedSize
        Get
            Return False
        End Get
    End Property

    Public ReadOnly Property IsReadOnly() As Boolean Implements System.Collections.IList.IsReadOnly
        Get
            Return False
        End Get
    End Property

#End Region


    Default Protected Overridable Property Item(ByVal index As Integer) As Object Implements System.Collections.IList.Item
        Get
            Return Me.Alist.Item(index)
        End Get
        Set(ByVal Value As Object)
            Alist.Item(index) = Value
            RaiseEvent Change(Me, New EventArgs)
        End Set
    End Property

    Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
        TEnum.Reset()
        Return TEnum
        'Return New BVToolBarButtonEnumerator(Me.Alist)
    End Function


    Public Overridable Sub AddRange(ByVal Values() As Object)
        Alist.AddRange(Values)
        RaiseEvent Change(Me, New EventArgs)
    End Sub

    Public Overridable Sub Clear() Implements System.Collections.IList.Clear
        Alist.Clear()
    End Sub

    Public Overridable Sub CopyTo(ByVal array As System.Array, ByVal index As Integer) Implements System.Collections.ICollection.CopyTo
        Me.Alist.CopyTo(array, index)
    End Sub

    Public Overridable Function Contains(ByVal value As Object) As Boolean Implements System.Collections.IList.Contains
        Return Alist.Contains(value)
    End Function

    Public Overridable Function IndexOf(ByVal value As Object) As Integer Implements System.Collections.IList.IndexOf
        Return Alist.IndexOf(value)
    End Function

    Public Sub Insert(ByVal index As Integer, ByVal value As Object) Implements System.Collections.IList.Insert
        Alist.Insert(index, value)
        RaiseEvent Change(Me, New EventArgs)
    End Sub

    Protected Overridable Function Add(ByVal value As Object) As Integer Implements System.Collections.IList.Add
        Add = Alist.Add(value)
        RaiseEvent Change(Me, New EventArgs)
    End Function

    Public Overridable Sub Remove(ByVal value As Object) Implements System.Collections.IList.Remove
        If Alist.Contains(value) Then
            Alist.Remove(value)
            RaiseEvent Change(Me, New EventArgs)
        End If
    End Sub

    Public Overridable Sub RemoveAt(ByVal index As Integer) Implements System.Collections.IList.RemoveAt
        Alist.RemoveAt(index)
        RaiseEvent Change(Me, New EventArgs)
    End Sub

    Protected Sub OnChange(ByVal sender As Object, ByVal e As EventArgs)
        RaiseEvent Change(sender, e)
    End Sub


End Class


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Engineer Universidad Tecnológica Nacional
Argentina Argentina
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions