Imports System.Windows.Forms

Public Class RectButton
  Implements Command
  Private bt As ToolBarButton
  Private med As Mediator
  '-----
  Public Sub New(ByVal md As Mediator, ByVal but As ToolBarButton)
    bt = but
    med = md
    med.registerRectButton(Me)
  End Sub
  '-----
  Public Sub setSelected(ByVal sel As Boolean)
    If sel Then
      bt.Pushed = True
    Else
      bt.Pushed = False
    End If
  End Sub

  Public Sub Execute() Implements vbnetMemento.Command.Execute
    If bt.Pushed Then
      med.startRectangle()
    End If

  End Sub

End Class
