home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Planet Source Code Jumbo …e CD Visual Basic 1 to 7
/
3_2004-2005.ISO
/
Data
/
Zips
/
Ulli's_Cod1877074152005.psc
/
cStack.cls
< prev
next >
Wrap
Text File
|
2005-04-15
|
2KB
|
72 lines
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "cStack"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
DefLng A-Z 'we're 32 bit
'stack to keep track of the treeview nodes
Private NodeStack() As MSComctlLib.Node
Private Index As Long
Private Capacity As Long
Private Sub Class_Initialize()
Reset 5
End Sub
Private Sub Class_Terminate()
Reset 0
End Sub
Public Function Pop() As MSComctlLib.Node
If Index Then
Dec Index
Set Pop = NodeStack(Index)
Else 'INDEX = FALSE/0
Set Pop = Nothing
End If
End Function
Public Sub Push(NodeToPush As MSComctlLib.Node)
If Index > Capacity Then
ReDim Preserve NodeStack(Index + 5)
Capacity = Index + 5
End If
Set NodeStack(Index) = NodeToPush
Inc Index
End Sub
Public Sub Reset(Cap As Long)
Index = 0
ReDim NodeStack(Cap)
Capacity = Cap
End Sub
Public Static Property Get StackSize() As Long
StackSize = Index
End Property
':) Ulli's VB Code Formatter V2.19.3 (2005-Apr-15 18:53) Decl: 7 Code: 51 Total: 58 Lines
':) CommentOnly: 1 (1,7%) Commented: 2 (3,4%) Empty: 19 (32,8%) Max Logic Depth: 2