vbAccelerator - Contents of code file: cCommandBarButtons.cls
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "cCommandBarButtons"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
' This class is a proxy via the control onto a cCommandBar class
' to access the button collection related methods
Private m_hWnd As Long
Private m_sKey As String
Friend Function fInit(ByVal hWnd As Long, ByVal sKey As String)
m_hWnd = hWnd
m_sKey = sKey
End Function
Public Property Get Count() As Long
Dim ctl As vbalCommandBar
If (ControlFromhWnd(m_hWnd, ctl)) Then
Count = ctl.BarButtonCount(m_sKey)
End If
End Property
Public Property Get Item(index As Variant) As cButton
Attribute Item.VB_UserMemId = 0
Dim ctl As vbalCommandBar
If (ControlFromhWnd(m_hWnd, ctl)) Then
Set Item = ctl.BarButton(m_sKey, index)
End If
End Property
Public Sub Clear()
Dim ctl As vbalCommandBar
If (ControlFromhWnd(m_hWnd, ctl)) Then
ctl.BarButtonClear m_sKey
End If
End Sub
Public Sub Remove(ByVal sKey As String)
Dim ctl As vbalCommandBar
If (ControlFromhWnd(m_hWnd, ctl)) Then
ctl.BarButtonRemove m_sKey, sKey
End If
End Sub
Public Sub Add(btn As cButton)
Dim ctl As vbalCommandBar
If (ControlFromhWnd(m_hWnd, ctl)) Then
ctl.BarButtonAdd m_sKey, btn
End If
End Sub
Public Sub InsertBefore(btn As cButton, btnBefore As cButton)
Dim ctl As vbalCommandBar
If (ControlFromhWnd(m_hWnd, ctl)) Then
ctl.BarButtonInsertBefore m_sKey, btn, btnBefore
End If
End Sub
Public Sub InsertAfter(btn As cButton, btnAfter As cButton)
Dim ctl As vbalCommandBar
If (ControlFromhWnd(m_hWnd, ctl)) Then
ctl.BarButtonInsertAfter m_sKey, btn, btnAfter
End If
End Sub
|
|