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

Public WithEvents m_objStatusBar As XtremeCommandBars.Statusbar
Attribute m_objStatusBar.VB_VarHelpID = -1

Public Event DblClick(ByVal lPaneID As Long)
Public Event Click(ByVal lPaneID As Long)

Private Sub Class_Initialize()

    Dim oPane As XtremeCommandBars.StatusBarPane

    Dim SAFont As StdFont
    Set SAFont = SAUtilsFont()
    Set m_objStatusBar = fMainForm.ctlCommandBar.Statusbar

    m_objStatusBar.ToolTipContext.Style = xtpToolTipBalloon
    
    Set oPane = m_objStatusBar.AddPane(1)
    oPane.Text = SAXRes.GetLocalString(IDS_sa2001sastatusbarcls_____creatingapplicationobjects)
    oPane.Width = 75
    oPane.Style = SBPS_STRETCH
    If Not (SAFont Is Nothing) Then
        oPane.Font = SAFont
    End If
    
    Set oPane = m_objStatusBar.AddPane(5)
    oPane.Visible = False
    oPane.Handle = fMainForm.ProgressBar.hWnd
    oPane.ToolTip = SAXRes.GetLocalString(IDS_sa2001sastatusbarcls_____progress)
    oPane.Width = 100
    
    Set oPane = m_objStatusBar.AddPane(6)
    oPane.Visible = False
    oPane.Text = "Cancel" ' "AAAAAAAAAAAAAAAARRRRRRRR!" ' testing auto-sizing below
    oPane.Handle = fMainForm.btnCancel.hWnd
    fMainForm.btnCancel.Caption = oPane.Text
    oPane.Text = " " & oPane.Text & " " ' Padding needed to allow auto-size to cope with making the button disabled
    oPane.Style = SBPS_NOBORDERS ' Or SBPS_STRETCH is no good here
    oPane.Width = 0 ' This WILL auto-size the panel from its text, and in turn sizes the button
    
    Set oPane = m_objStatusBar.AddPane(2)
    oPane.Visible = False
    oPane.ToolTip = SAXRes.GetLocalString(IDS_sa2001sastatusbarcls_____symbolposition)
    oPane.Width = 100
    
    Set oPane = m_objStatusBar.AddPane(3)
    oPane.Visible = False
    oPane.ToolTip = SAXRes.GetLocalString(IDS_sa2001sastatusbarcls_____symbolsize)
    oPane.Width = 100
    
    Set oPane = m_objStatusBar.AddPane(4)
    oPane.Text = vbNullString
    oPane.ToolTip = SAXRes.GetLocalString(IDS_sa2001sastatusbarcls_____auditid)
    oPane.Width = 75
    If Not (SAFont Is Nothing) Then
        oPane.Font = SAFont
    End If
    m_objStatusBar.Visible = True
        
End Sub

Public Sub SetText(ByVal lPane As Long, ByVal strText As String)
    
    On Error GoTo ErrorHandler
    
    m_objStatusBar.FindPane(lPane).Text = strText
    m_objStatusBar.FindPane(lPane).Width = 0
    
    Exit Sub
    
ErrorHandler:
    
End Sub

Public Sub SetState(ByVal lPane As Long, ByVal bShow As Boolean)
    
    On Error GoTo ErrorHandler
    
    m_objStatusBar.FindPane(lPane).Visible = bShow
    If lPane = 6 Then
        If bShow Then
            fMainForm.btnCancel.Enabled = True
        End If
        SACancelState = False
    End If
    
    Exit Sub
    
ErrorHandler:
    
End Sub

Public Function GetState(ByVal lPane As Long) As Boolean
    
    On Error GoTo ErrorHandler
    
    GetState = m_objStatusBar.FindPane(lPane).Visible
    
    Exit Function
    
ErrorHandler:
    
End Function

Public Sub SetTextColor(ByVal lPane As Long, ByVal lColor As Long)
    
    On Error GoTo ErrorHandler
    
    m_objStatusBar.FindPane(lPane).TextColor = lColor
    
    Exit Sub
    
ErrorHandler:
    
End Sub

Public Sub SetBackgroundColor(ByVal lPane As Long, ByVal lColor As Long)
    
    On Error GoTo ErrorHandler
    
    m_objStatusBar.FindPane(lPane).BackgroundColor = lColor
    
    Exit Sub
    
ErrorHandler:
    
End Sub

Public Sub SetFont(ByVal lPane As Long, ByVal oFont As IFontDisp)
    
    On Error GoTo ErrorHandler
    
    m_objStatusBar.FindPane(lPane).Font = oFont
    
    Exit Sub
    
ErrorHandler:
    
End Sub

Private Sub m_objStatusBar_PaneClick(ByVal Pane As XtremeCommandBars.StatusBarPane)

    RaiseEvent Click(Pane.Id)

End Sub

Private Sub m_objStatusBar_PaneDblClick(ByVal Pane As XtremeCommandBars.StatusBarPane)
    
    RaiseEvent DblClick(Pane.Id)
    
End Sub
