VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "StateManager"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'Klasa StateManager
Private currentState As State
Private rState As RectState
Private aState As ArrowState
Private cState As CircleState
Private fState As FillState
'-----
Public Sub init(med As Mediator)
  'Utwórz po instancji dla każdej z klas stanów
  Set rState = New RectState
  Set cState = New CircleState
  Set aState = New ArrowState
  Set fState = New FillState
  'I zainicjuj je
  rState.init med
  cState.init med
  aState.init med
  fState.init med
  'Ustaw stan domyślny
  Set currentState = aState
End Sub
'-----
'Metody wykonywane po wybraniu przycisków
Public Sub setRect()
  Set currentState = rState
End Sub
'-----
Public Sub setCircle()
  Set currentState = cState
End Sub
'-----
Public Sub setFill()
  Set currentState = fState
End Sub
'-----
Public Sub setArrow()
  Set currentState = aState
End Sub
'-----
Public Sub mouseDown(x As Integer, y As Integer)
  currentState.mouseDown x, y
End Sub
'-----
Public Sub mouseUp(x As Integer, y As Integer)
  currentState.mouseUp x, y
End Sub
'-----
Public Sub mouseDrag(x As Integer, y As Integer)
  currentState.mouseDrag x, y
End Sub
'-----
Public Sub selectOne(d As Drawing, c As ColorConstants)
  currentState.selectOne d
End Sub
