vbAccelerator - Contents of code file: cCommandBarItemInt.cls

VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "cCommandBarItemInt"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

' cComamndBarItemInt is a real cCommandBarItem object.
' It holds the description of the item, a collection of object
' pointers to the owning command bar(s)

Private m_sKey As String
Private m_sCaption As String
Private m_iIconIndex As Long
Private m_bShowCaptionInToolbar As Boolean
Private m_eStyle As EButtonStyle

' Owning bar collection:
Private m_ptrBars As Collection

Friend Function RemovedFromBar(Bar As cCommandBarInt)
   m_ptrBars.Remove Bar.Key
End Function
Friend Function AddedToBar(Bar As cCommandBarInt)
   m_ptrBars.Add ObjPtr(Bar), Bar.Key
End Function

Friend Property Get Key() As String
   Key = m_sKey
End Property

Friend Property Get Caption() As String
   Caption = m_sCaption
End Property
Friend Property Let Caption(ByVal sCaption As String)
   m_sCaption = sCaption
   NotifyUsers 4
End Property

Friend Property Get IconIndex() As Long
   IconIndex = m_iIconIndex
End Property
Friend Property Let IconIndex(ByVal lIconIndex As Long)
   m_iIconIndex = lIconIndex
   NotifyUsers 5
End Property

Friend Property Get Style() As EButtonStyle
   Style = m_eStyle
End Property
Friend Property Let Style(eStyle As EButtonStyle)
   m_eStyle = eStyle
   NotifyUsers 4
End Property

Friend Property Get Bar() As cCommandBarInt
   
End Property
Friend Property Let Bar(cmdBar As cCommandBarInt)

End Property
Friend Property Set Bar(cmdBar As cCommandBarInt)

End Property
Private Function setBar(cmdBar As cCommandBarInt)

End Function


Friend Sub NotifyUsers(ByVal eventType As Long)
Dim vlPtr As Variant
Dim Bar As cCommandBarInt
   For Each vlPtr In m_ptrBars
      Set Bar = ObjectFromPtr(vlPtr)
      If Not (Bar Is Nothing) Then
         Bar.NotifyUsers eventType, Me
      End If
   Next
End Sub

Private Sub Class_Initialize()
   Set m_ptrBars = New Collection
End Sub