vbAccelerator - Contents of code file: cButtons.cls
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "cButtons"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
' cCommandBars is not a real object. It is a proxy
' onto the mCommandBars.m_colCommandBarItems collection,
' given that the owning control exists.
Private m_hWnd As Long
Friend Sub fInit(ByVal hWnd As Long)
m_hWnd = hWnd
End Sub
Public Property Get Count() As Long
Dim ctl As vbalCommandBar
If (ControlFromhWnd(m_hWnd, ctl)) Then
Count = ctl.BarCount()
End If
End Property
Public Property Get Item(ByVal index As Variant)
Attribute Item.VB_UserMemId = 0
Dim ctl As vbalCommandBar
If (ControlFromhWnd(m_hWnd, ctl)) Then
Set Item = ctl.ButtonItem(index)
End If
End Property
Public Sub Remove(ByVal sKey As String)
Dim ctl As vbalCommandBar
If (ControlFromhWnd(m_hWnd, ctl)) Then
ctl.ButtonRemove sKey
End If
End Sub
Public Function Add( _
ByVal sKey As String, _
Optional ByVal iIcon As Long = -1, _
Optional ByVal sCaption As String = "", _
Optional ByVal eStyle As EButtonStyle = eNormal, _
Optional ByVal sToolTip As String = "", _
Optional ByVal sShortcutKey As String = "", _
Optional ByVal eShortcutModifier As ShiftConstants = vbCtrlMask _
) As cButton
Dim ctl As vbalCommandBar
If (ControlFromhWnd(m_hWnd, ctl)) Then
Set Add = ctl.ButtonAdd(sKey, iIcon, sCaption, eStyle, sToolTip,
sShortcutKey, eShortcutModifier)
End If
End Function
|
|