# File vtk/tk/vtkTkImageViewerWidget.rb, line 86
  def BindTkImageViewer
    imager = @ImageViewer.GetRenderer
        
    # stuff for window level text.
    mapper = Vtk::TextMapper.new
    mapper.SetInput("none")
    t_prop = mapper.GetTextProperty
    t_prop.SetFontFamilyToTimes
    t_prop.SetFontSize(18)
    t_prop.BoldOn
    t_prop.ShadowOn
        
    @LevelMapper = mapper

    actor = Vtk::Actor2D.new
    actor.SetMapper(mapper)
    actor.SetLayerNumber(1)
    actor.GetPositionCoordinate.SetValue(4,22)
    actor.GetProperty.SetColor(1,1,0.5)
    actor.SetVisibility(0)
    imager.AddActor2D(actor)

    @LevelActor = actor
                
    mapper = Vtk::TextMapper.new
    mapper.SetInput("none")
    t_prop = mapper.GetTextProperty
    t_prop.SetFontFamilyToTimes
    t_prop.SetFontSize(18)
    t_prop.BoldOn
    t_prop.ShadowOn
    
    @WindowMapper = mapper

    actor = Vtk::Actor2D.new
    actor.SetMapper(mapper)
    actor.SetLayerNumber(1)
    actor.GetPositionCoordinate.SetValue(4,4)
    actor.GetProperty.SetColor(1,1,0.5)
    actor.SetVisibility(0)
    imager.AddActor2D(actor)

    @WindowActor = actor

    @LastX = 0
    @LastY = 0
    @OldFocus = 0
    @InExpose = 0
    
    # bindings
    # window level
    self.bind("ButtonPress-1"){|e,s| s||s=self; s.StartWindowLevelInteraction(e.x,e.y) }
    self.bind("B1-Motion"){|e,s| s||s=self; s.UpdateWindowLevelInteraction(e.x,e.y) }
    self.bind("ButtonRelease-1"){|e,s| s||s=self; s.EndWindowLevelInteraction }
    
    # Get the value
    self.bind("ButtonPress-3"){|e,s| s||s=self; s.StartQueryInteraction(e.x,e.y) }
    self.bind("B3-Motion"){|e,s| s||s=self; s.UpdateQueryInteraction(e.x,e.y) }
    self.bind("ButtonRelease-3"){|e,s| s||s=self; s.EndQueryInteraction }

    self.bind("Expose"){|e,s| s||s=self; s.ExposeTkImageViewer }
    self.bind("Enter"){|e,s| s||s=self; s.EnterTkViewer }
    self.bind("Leave"){|e,s| s||s=self; s.LeaveTkViewer }
    self.bind("KeyPress-e"){|e,s| s||s=self; exit }
    self.bind("KeyPress-r"){|e,s| s||s=self; s.ResetTkImageViewer }
  end