forked from lee-soft/ViPad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ViBank.cls
117 lines (87 loc) · 3.24 KB
/
ViBank.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "ViBank"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private m_itemBank As Collection
Public masterCollection As Collection
Public Function CleanMasterCollectionOfCollection(ByRef theCollection As Collection)
Dim thisItem As LaunchPadItem
For Each thisItem In theCollection
masterCollection.Remove thisItem.GlobalIdentifer
Next
End Function
Public Function CleanMasterCollection(ByRef collectionIndex As Long)
Dim thisCollection As Collection
Dim thisItem As LaunchPadItem
Set thisCollection = m_itemBank(collectionIndex).Children
For Each thisItem In thisCollection
masterCollection.Remove thisItem.GlobalIdentifer
Next
End Function
Public Function RemoveTab(ByVal theTabIdentifier As String)
Dim thisCollection As Collection
Set thisCollection = m_itemBank(theTabIdentifier).Children
CleanMasterCollectionOfCollection thisCollection
m_itemBank.Remove theTabIdentifier
End Function
Public Function RemoveIndex(ByVal collectionIndex As Long)
CleanMasterCollection collectionIndex
m_itemBank.Remove collectionIndex
'm_itemAliases.Remove collectionIndex
End Function
Public Function GetBank() As Collection
Set GetBank = m_itemBank
End Function
Public Function GetCollectionCount()
GetCollectionCount = m_itemBank.count
End Function
Public Function SetCollectionAlias(ByVal collectionIndex As Long, newAlias As String)
m_itemBank(collectionIndex).Alias = newAlias
End Function
Public Function GetTabByIndex(ByVal tabIndex As Long) As ViTab
On Error GoTo Handler
Set GetTabByIndex = m_itemBank(tabIndex)
Exit Function
Handler:
MsgBox "Tab Index: '" & tabIndex & "' doesn't exist!", vbCritical
End Function
Public Function GetCollectionAlias(ByVal collectionIndex As Long) As String
On Error GoTo Handler
GetCollectionAlias = m_itemBank(collectionIndex).Alias
Exit Function
Handler:
MsgBox "Collection Index: '" & collectionIndex & "' doesn't exist!", vbCritical
End Function
Public Function GetCollectionByIndex(ByVal collectionIndex As Long) As Collection
On Error GoTo Handler
While Me.GetCollectionCount < collectionIndex
Me.AddNewCollection "New Tab"
Wend
Set GetCollectionByIndex = m_itemBank(collectionIndex).Children
Exit Function
Handler:
MsgBox "Collection Index: '" & collectionIndex & "' doesn't exist!", vbCritical
End Function
Public Function AddNewCollection(ByVal collectionIdentifier As String) As ViTab
Debug.Print "AddNewCollection!"
Set AddNewCollection = New ViTab
AddNewCollection.Alias = collectionIdentifier
AddNewCollection.SharedViPadIdentifer = ProgramSupport.GetNextViPadKey
m_itemBank.Add AddNewCollection, AddNewCollection.SharedViPadIdentifer
PrintHeader Me
End Function
Private Sub Class_Initialize()
Set masterCollection = New Collection
Set m_itemBank = New Collection
'Set m_itemAliases = New Collection
End Sub