VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "NodeInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Public LoadType As TreeLoadType
Public IDIndex As Integer
Public ParentIDIndex As Integer
Public TextIndex As Integer
Public DirectImages As Boolean
Public ImageIndex As Integer
Public SelectedImageIndex As Integer
Public SortIndex As Integer

Public mo_Node As Node
Public mb_ChildrenLoaded As Boolean
Public mb_ChildsCountDetected As Boolean
Public mb_AutoLoaded As Boolean
Public ml_Level As Long
Public ml_ChildCount As Long
Public ml_State As Long
Public hItem As Long

Private NodeData() As Variant

Public Function GetData(ByVal li_Index As Integer) As Variant
  GetData = ""
  If (li_Index >= LBound(NodeData)) And (li_Index <= UBound(NodeData)) Then
      GetData = NodeData(li_Index)
  End If
End Function

Public Sub SetData(ByVal li_Index As Integer, lv_Value As Variant)
  If (li_Index >= LBound(NodeData)) And (li_Index <= UBound(NodeData)) Then
     NodeData(li_Index) = lv_Value
  End If
End Sub

Public Sub CopyDataDef(ByVal lo_NodeInfo As NodeInfo)
  If Not (lo_NodeInfo Is Nothing) Then
    LoadType = lo_NodeInfo.LoadType
    IDIndex = lo_NodeInfo.IDIndex
    ParentIDIndex = lo_NodeInfo.ParentIDIndex
    TextIndex = lo_NodeInfo.TextIndex
    DirectImages = lo_NodeInfo.DirectImages
    ImageIndex = lo_NodeInfo.ImageIndex
    SelectedImageIndex = lo_NodeInfo.SelectedImageIndex
    SortIndex = lo_NodeInfo.SortIndex
  End If
End Sub

Public Property Get IDValue() As Variant
  IDValue = GetData(IDIndex)
End Property

Public Property Let IDValue(ByVal vNewValue As Variant)
  Call SetData(IDIndex, vNewValue)
End Property


Public Property Get ParentIDValue() As Variant
  ParentIDValue = GetData(ParentIDIndex)
End Property

Public Property Let ParentIDValue(ByVal vNewValue As Variant)
  Call SetData(ParentIDIndex, vNewValue)
End Property


Public Property Get ImageValue() As Integer
  If DirectImages Then
    ImageValue = ImageIndex
  Else
    ImageValue = GetData(ImageIndex)
  End If
End Property

Public Property Let ImageValue(ByVal vNewValue As Integer)
  If DirectImages Then
    ImageIndex = vNewValue
  Else
    Call SetData(ImageIndex, vNewValue)
  End If
End Property

Public Property Get SelectedImageValue() As Integer
  If DirectImages Then
    SelectedImageValue = SelectedImageIndex
  Else
    SelectedImageValue = GetData(SelectedImageIndex)
  End If
End Property

Public Property Let SelectedImageValue(ByVal vNewValue As Integer)
  If DirectImages Then
    SelectedImageIndex = vNewValue
  Else
    Call SetData(SelectedImageIndex, vNewValue)
  End If
End Property

Public Property Get TextValue() As String
Dim ls_Text As String
  
  ls_Text = GetData(TextIndex)
  If Trim(ls_Text) = "" Then
    TextValue = "****"
  Else
    TextValue = ls_Text
  End If
End Property

Public Property Let TextValue(ByVal vNewValue As String)
  Call SetData(TextIndex, vNewValue)
End Property

Public Sub SetNodeDataSize(ByVal ll_NodeDataSize As Long)
  ReDim NodeData(0 To ll_NodeDataSize)
End Sub

Public Function Length() As Long
  Length = -1
  If IsArray(NodeData) Then Length = UBound(NodeData)
End Function

Private Sub Class_Initialize()
 mb_AutoLoaded = True
 IDIndex = 0
 ParentIDIndex = 1
 TextIndex = 2
 ImageIndex = 3
 SelectedImageIndex = 4
End Sub


