VERSION 5.00
Begin VB.Form frmSideBar 
   BorderStyle     =   0  'None
   Caption         =   "Quotation Wizard Management Info"
   ClientHeight    =   6495
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   3615
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6495
   ScaleWidth      =   3615
   ShowInTaskbar   =   0   'False
   Begin VB.Frame fraActiveTasks 
      Caption         =   "Active Tasks"
      Height          =   1455
      Left            =   120
      TabIndex        =   0
      Top             =   1680
      Width           =   3375
      Begin VB.ListBox lstActiveTasks 
         Height          =   1035
         ItemData        =   "frmSideBar.frx":0000
         Left            =   240
         List            =   "frmSideBar.frx":0002
         TabIndex        =   1
         ToolTipText     =   "Quotation Wizard Tasks that are urrently active but not complete"
         Top             =   240
         Width           =   2895
      End
   End
   Begin VB.Line shpDivide 
      X1              =   120
      X2              =   120
      Y1              =   3120
      Y2              =   4560
   End
   Begin VB.Menu mnuActiveTasks 
      Caption         =   "Active &Tasks"
      Visible         =   0   'False
      Begin VB.Menu mnuRestoreActiveTask 
         Caption         =   "&Restore Active Task"
      End
      Begin VB.Menu mnuCloseActiveTask 
         Caption         =   "&Close Active Task"
      End
      Begin VB.Menu mnuCloseAllActiveTasks 
         Caption         =   "Close &All Active Tasks"
      End
   End
End
Attribute VB_Name = "frmSideBar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Private Sub Form_Resize()
  With Me
    .Width = SIDE_BAR_WIDTH
    .Height = mdiMain.ScaleHeight
    .Left = mdiMain.ScaleWidth - Me.Width
    .Top = 0
  End With
  
  With fraActiveTasks
    .Height = Me.Height / 5
    .Width = Me.Width - (MARGIN_WIDTH * 2)
    .Top = Me.Height - .Height - MARGIN_WIDTH
    .Left = MARGIN_WIDTH
  End With
  
  With lstActiveTasks
    .Height = fraActiveTasks.Height - (MARGIN_WIDTH * 2)
    .Width = fraActiveTasks.Width - (MARGIN_WIDTH * 2)
    .Top = fraActiveTasks.Height - .Height - MARGIN_WIDTH
    .Left = MARGIN_WIDTH
  End With
  
  shpDivide.X1 = 0
  shpDivide.Y1 = 0
  shpDivide.X2 = 0
  shpDivide.Y2 = Me.Height
End Sub

Private Sub lstActiveTasks_DblClick()
  Select Case lstActiveTasks.Text
    Case Is = CREATE_NEW_QUOTATION
      With frmCreateNewQuotation
        .WindowState = vbNormal
        .SetFocus
      End With
    Case Is = PRINT_EXISTING_QUOTATION
      With frmPrintExistingQuotation
        .WindowState = vbNormal
        .SetFocus
      End With
    Case Is = DELETE_EXISTING_QUOTATION
      With frmDeleteExistingQuotation
        .WindowState = vbNormal
        .SetFocus
      End With
  End Select
End Sub

Private Sub lstActiveTasks_KeyDown(KeyCode As Integer, Shift As Integer)
  Dim FormFocus As Form
  
  Set FormFocus = GetCurrentForm
  FormFocus.SetFocus
  Set FormFocus = Nothing
End Sub

Private Sub lstActiveTasks_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Button = vbRightButton Then
    mouse_event 2, 0&, 0&, 0&, 0&
    mouse_event 4, 0&, 0&, 0&, 0&
  End If
End Sub

Private Sub lstActiveTasks_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  Dim i As Integer
  
  If Not lstActiveTasks.ListCount = 0 Then
    If Button = vbRightButton Then
      For i = 0 To lstActiveTasks.ListCount - 1
      DoEvents
        If lstActiveTasks.Selected(i) = True Then
          PopupMenu mnuActiveTasks
          Exit Sub
        End If
      Next i
    End If
  End If
End Sub

Private Sub mnuCloseActiveTask_Click()
  Select Case lstActiveTasks.Text
    Case Is = CREATE_NEW_QUOTATION
      Unload frmCreateNewQuotation
    Case Is = PRINT_EXISTING_QUOTATION
      Unload frmPrintExistingQuotation
    Case Is = DELETE_EXISTING_QUOTATION
      Unload frmDeleteExistingQuotation
  End Select
End Sub

Private Sub mnuCloseAllActiveTasks_Click()
  Dim i As Integer
  
  For i = 0 To lstActiveTasks.ListCount - 1
    Select Case lstActiveTasks.List(0)
      Case Is = CREATE_NEW_QUOTATION
        frmCreateNewQuotation.UnloadForm
      Case Is = PRINT_EXISTING_QUOTATION
        frmPrintExistingQuotation.UnloadForm
      Case Is = DELETE_EXISTING_QUOTATION
        frmDeleteExistingQuotation.UnloadForm
    End Select
  Next i
End Sub

Private Sub mnuRestoreActiveTask_Click()
  lstActiveTasks_DblClick
End Sub
