vbAccelerator - Contents of code file: cButton.cls

VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "cButton"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Private m_hWnd As Long
Private m_sKey As String

Friend Sub fInit(ByVal hWnd As Long, ByVal sKey As String)
   m_hWnd = hWnd
   m_sKey = sKey
End Sub

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

Public Property Get Caption() As String
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      Caption = ctl.ButtonCaption(m_sKey)
   End If
End Property
Public Property Let Caption(ByVal sCaption As String)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ctl.ButtonCaption(m_sKey) = sCaption
   End If
End Property

Public Property Get ToolTip() As String
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ToolTip = ctl.ButtonToolTip(m_sKey)
   End If
End Property
Public Property Let ToolTip(ByVal sToolTip As String)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ctl.ButtonToolTip(m_sKey) = sToolTip
   End If
End Property

Public Property Get ShortcutKey() As String
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ShortcutKey = ctl.ButtonShortcutKey(m_sKey)
   End If
End Property
Public Property Let ShortcutKey(ByVal sShortcutKey As String)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ctl.ButtonShortcutKey(m_sKey) = sShortcutKey
   End If
End Property

Public Property Get ShortcutModifiers() As ShiftConstants
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ShortcutModifiers = ctl.ButtonShortcutModifiers(m_sKey)
   End If
End Property
Public Property Let ShortcutModifiers(ByVal eShortcutModifiers As
 ShiftConstants)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ctl.ButtonShortcutModifiers(m_sKey) = eShortcutModifiers
   End If
End Property

Public Property Get Bar() As cCommandBar
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      Set Bar = ctl.ButtonBar(m_sKey)
   End If
End Property

Public Property Let Bar(cmdBar As cCommandBar)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ctl.ButtonSetBar m_sKey, cmdBar
   End If
End Property
Public Property Set Bar(cmdBar As cCommandBar)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ctl.ButtonSetBar m_sKey, cmdBar
   End If
End Property

Public Property Get Checked() As Boolean
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      Checked = ctl.ButtonChecked(m_sKey)
   End If
End Property
Public Property Let Checked(ByVal bChecked As Boolean)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ctl.ButtonChecked(m_sKey) = bChecked
   End If
End Property

Public Property Get Enabled() As Boolean
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      Enabled = ctl.ButtonEnabled(m_sKey)
   End If
End Property
Public Property Let Enabled(ByVal bEnabled As Boolean)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ctl.ButtonEnabled(m_sKey) = bEnabled
   End If
End Property

Public Property Get ShowCaptionInToolbar() As Boolean
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ShowCaptionInToolbar = ctl.ButtonShowCaptionInToolbar(m_sKey)
   End If
End Property
Public Property Let ShowCaptionInToolbar(ByVal bShowCaptionInToolbar As Boolean)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ctl.ButtonShowCaptionInToolbar(m_sKey) = bShowCaptionInToolbar
   End If
End Property

Public Property Get ShowDropDownInToolbar() As Boolean
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ShowCaptionInToolbar = ctl.ButtonShowDropDownInToolbar(m_sKey)
   End If
End Property
Public Property Let ShowDropDownInToolbar(ByVal bShowDropDownInToolbar As
 Boolean)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ctl.ButtonShowDropDownInToolbar(m_sKey) = bShowDropDownInToolbar
   End If
End Property

Public Property Get Visible() As Boolean
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      Visible = ctl.ButtonVisible(m_sKey)
   End If
End Property
Public Property Let Visible(ByVal bVisible As Boolean)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ctl.ButtonVisible(m_sKey) = bVisible
   End If
End Property

Public Property Get PanelWidth() As Long
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      PanelWidth = ctl.ButtonPanelWidth(m_sKey)
   End If
End Property
Public Property Let PanelWidth(ByVal lPanelWidth As Long)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      ctl.ButtonPanelWidth(m_sKey) = lPanelWidth
   End If
End Property

Public Property Get PanelControl() As Object
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      Set PanelControl = ctl.ButtonPanelControl(m_sKey)
   End If
End Property
Public Property Let PanelControl(ctlPanel As Object)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      Set ctl.ButtonPanelControl(m_sKey) = ctlPanel
   End If
End Property
Public Property Set PanelControl(ctlPanel As Object)
Dim ctl As vbalCommandBar
   If (ControlFromhWnd(m_hWnd, ctl)) Then
      Set ctl.ButtonPanelControl(m_sKey) = ctlPanel
   End If
End Property