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

Implements Chain
Private pc As PictureBox
Private chn As Chain
Private hasLink As Boolean

Private Sub Chain_addChain(c As Chain)
  Set chn = c
  hasLink = True
End Sub

Private Function Chain_getChain() As Chain
  Set Chain_getChain = chn
  hasLink = True
End Function

Private Function Chain_hasChain() As Boolean
  Chain_hasChain = hasLink
End Function

Private Sub Chain_sendToChain(mesg As String)
  Dim colr As Long, found As Boolean
  found = True
  Select Case LCase(mesg) 'Przeszukaj znane koloery
    Case "red"
      colr = vbRed
    Case "blue"
      colr = vbBlue
    Case "green"
      colr = vbGreen
    Case Else
    'Jeśli nie znaleziono, przeslij dalej
      If hasLink Then
        chn.sendToChain mesg
        found = False   'Nie znaleziono
      End If
  End Select
  'Ustaw kolor
  If found Then
    pc.BackColor = colr
  End If
End Sub

Private Sub Chain_setControl(c As Control)
  Set pc = c
End Sub
