cClosedPages.cls
资源名称:IE_VB.rar [点击查看]
上传用户:davilee3
上传日期:2015-04-22
资源大小:986k
文件大小:5k
源码类别:
浏览器
开发平台:
Visual Basic
- VERSION 1.0 CLASS
- BEGIN
- MultiUse = -1 'True
- Persistable = 0 'NotPersistable
- DataBindingBehavior = 0 'vbNone
- DataSourceBehavior = 0 'vbNone
- MTSTransactionMode = 0 'NotAnMTSObject
- END
- Attribute VB_Name = "cClosedPages"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = False
- '关闭的页面
- Option Explicit
- 'Private Type mTypPage
- ' Title As String
- ' Url As String
- 'End Type
- Private mPage() As UrlSimpleInfo
- Private mPageCnt&
- 'Public Event eAdd(nTitle As String, nUrl As String)
- Public Event eChange()
- Private Const mMaxMenuItem As Long = 20
- Private Const mMaxItem As Long = 50
- Private Sub Class_Initialize()
- mPageCnt = 0
- ReDim mPage(0 To mPageCnt)
- End Sub
- Public Sub Add(nTitle$, nUrl$, Optional canEvent As Boolean = True)
- Dim i&
- Dim repeatIndex&
- Dim tMenuCnt&
- 'Dim tDMnu As ClsSMenu, tcnt&
- nTitle = Trim(nTitle)
- nUrl = LCase(Trim(nUrl))
- repeatIndex = 0
- For i = mPageCnt To 1 Step -1
- If nTitle = mPage(i).Title And nUrl = mPage(i).Url Then
- repeatIndex = i
- Exit For
- End If
- Next i
- If repeatIndex > 0 Then
- For i = repeatIndex To mPageCnt - 1
- mPage(i) = mPage(i + 1)
- Next i
- mPage(mPageCnt).Title = nTitle
- mPage(mPageCnt).Url = nUrl
- Else
- If mPageCnt < mMaxItem Then
- mPageCnt = mPageCnt + 1
- ReDim Preserve mPage(0 To mPageCnt)
- mPage(mPageCnt).Title = nTitle
- mPage(mPageCnt).Url = nUrl
- Else
- For i = 1 To mPageCnt - 1
- mPage(i) = mPage(i + 1)
- Next i
- mPage(mPageCnt).Title = nTitle
- mPage(mPageCnt).Url = nUrl
- End If
- End If
- If mPageCnt > mMaxMenuItem Then
- tMenuCnt = mMaxMenuItem
- Else
- tMenuCnt = mPageCnt
- End If
- 'tcnt = SMenus.Count
- 'For i = tcnt To 1 Step -1
- ' If SMenus(i).Tag = "rcl" Then
- ' SMenus.Remove i
- ' End If
- 'Next i
- '
- 'With pMnu_Reopen
- ' .ClearItems
- ' For i = mPageCnt To mPageCnt - tMenuCnt + 1 Step -1
- ' .Add mPage(i).Title, , i
- ' RstMenu pMnu_Reopen.hwnd, i, , 2, 0, "rcl"
- ' Next i
- ' .Add "", pmsSeparator
- ' .Add "更多", pmsDisabled Or pmsString
- 'End With
- 'tcnt = SMenus.Count
- 'For i = tcnt To 1 Step -1
- ' If SMenus(i).Tag = "rcl" Then
- ' SMenus.Remove i
- ' End If
- 'Next i
- gODrawMenu.RemoveMulODMenu "rcl"
- 'Dim tmnu As Menu
- 'With gMainForm
- ' .mnuRecent_ClosePage(0).Visible = True
- ' For Each tmnu In .mnuRecent_ClosePage
- ' If tmnu.index <> 0 Then
- ' Unload tmnu
- ' End If
- ' Next tmnu
- '
- ' For i = mPageCnt To mPageCnt - tMenuCnt + 1 Step -1
- ' Load .mnuRecent_ClosePage(mPageCnt - i + 1)
- ' With .mnuRecent_ClosePage(mPageCnt - i + 1)
- ' .Caption = Mid2(mPage(i).Title, , 30, "...")
- ' .Tag = mPage(i).Url
- ' .Enabled = True
- ' End With
- ' 'RstMenu .hMnuReopen, mPageCnt - i + 1, , ImgK_Icon_Url, , , , "rcl"
- ' Next i
- ' If tMenuCnt > 0 Then
- ' .mnuRecent_ClosePage(0).Visible = False
- ' End If
- '
- 'End With
- pMnu_Reopen.ClearItems
- For i = mPageCnt To mPageCnt - tMenuCnt + 1 Step -1
- pMnu_Reopen.Add Mid2(mPage(i).Title, , 30, "..."), , i + IdOffset_Reopen
- gODrawMenu.RstMenu pMnu_Reopen.hWnd, mPageCnt - i, , ImgIx_Icon_Url, , , , "rcl"
- Next i
- If tMenuCnt > 0 Then
- Else
- pMnu_Reopen.Add "(空)", pmsString Or pmsDisabled
- End If
- pMnu_Reopen.Add "", pmsSeparator
- pMnu_Reopen.Add "更多", , IDM_Main_Favorite_Reopen_More
- RaiseEvent eChange
- 'If canEvent Then
- ' RaiseEvent eAdd(nTitle, nUrl)
- 'End If
- End Sub
- Public Property Get Count() As Long
- Count = mPageCnt
- End Property
- Public Sub Remove(index&)
- RaiseEvent eChange
- 'Dim i&
- 'If index <= mPageCnt Then
- ' For i = index To mPageCnt - 1
- ' mPage(i) = mPage(i + 1)
- ' Next i
- ' mPageCnt = mPageCnt - 1
- 'End If
- End Sub
- Public Sub Clear()
- mPageCnt = 0
- ReDim mPage(0 To mPageCnt)
- RaiseEvent eChange
- End Sub
- Public Sub SetAllPage(nTitle() As String, nUrl() As String, nCount&)
- Dim i&
- mPageCnt = nCount
- ReDim mPage(0 To mPageCnt)
- For i = 1 To mPageCnt
- mPage(i).Title = nTitle(i)
- mPage(i).Url = nUrl(i)
- Next i
- End Sub
- Public Function GetUrl(index&) As String
- If index > 0 And index <= mPageCnt Then
- GetUrl = mPage(index).Url
- Else
- GetUrl = ""
- End If
- End Function
- Public Function GetTitle(index&) As String
- If index > 0 And index <= mPageCnt Then
- GetTitle = mPage(index).Title
- Else
- GetTitle = ""
- End If
- End Function
- Public Function GetLastUrl() As String
- GetLastUrl = GetUrl(mPageCnt)
- End Function
- Public Sub Item(index&, nTitle$, nUrl$)
- nTitle = mPage(index).Title
- nUrl = mPage(index).Url
- End Sub
- '获取关闭页面信息
- Public Sub GetClosePages(nUrls() As String, nTitles() As String, nCount As Long)
- Dim i&
- nCount = mPageCnt
- ReDim nUrls(0 To mPageCnt)
- ReDim nTitles(0 To mPageCnt)
- For i = 1 To mPageCnt
- nUrls(i) = mPage(i).Url
- nTitles(i) = mPage(i).Title
- Next i
- End Sub