class Fox::FXPseudoMouse

An FXPseudoMouse object provides a simple means to operate widgets programmatically, to aid test driven design. An FXPseudoMouse instance can be pointed at an FXObject and will manage the sending of events to it.

For example:

canvas = FXCanvas.new(...)
pm = FXPseudoMouse.new(canvas)
pm.doLeftButtonPress # sends a SEL_LEFTBUTTONPRESS message to the canvas

Attributes

target[RW]

Public Class Methods

new(tgt=nil) click to toggle source
# File lib/fox16/pseudomouse.rb, line 18
def initialize(tgt=nil)
  @target = tgt
end

Public Instance Methods

doLeftButtonPress() click to toggle source
# File lib/fox16/pseudomouse.rb, line 38
def doLeftButtonPress
  unless @target.nil?
    evt = FXEvent.new
    evt.type = Fox::SEL_LEFTBUTTONPRESS
    @target.handle(self, Fox.FXSEL(Fox::SEL_LEFTBUTTONPRESS, 0), evt)
  end
end
doLeftButtonRelease() click to toggle source
# File lib/fox16/pseudomouse.rb, line 46
def doLeftButtonRelease
  unless @target.nil?
   evt = FXEvent.new
    evt.type = Fox::SEL_LEFTBUTTONRELEASE
   @target.handle(self, Fox.FXSEL(Fox::SEL_LEFTBUTTONRELEASE, 0), evt)
  end
end
doMiddleButtonPress() click to toggle source
# File lib/fox16/pseudomouse.rb, line 54
def doMiddleButtonPress
  unless @target.nil?
    evt = FXEvent.new
    evt.type = Fox::SEL_MIDDLEBUTTONPRESS
    @target.handle(self, Fox.FXSEL(Fox::SEL_MIDDLEBUTTONPRESS, 0), evt)
  end
end
doMiddleButtonRelease() click to toggle source
# File lib/fox16/pseudomouse.rb, line 62
def doMiddleButtonRelease
  unless @target.nil?
    evt = FXEvent.new
    evt.type = Fox::SEL_MIDDLEBUTTONRELEASE
    @target.handle(self, Fox.FXSEL(Fox::SEL_MIDDLEBUTTONRELEASE, 0), evt)
  end
end
doMotion() click to toggle source
# File lib/fox16/pseudomouse.rb, line 22
def doMotion
  unless @target.nil?
    evt = FXEvent.new
    evt.type = Fox::SEL_MOTION
    @target.handle(self, Fox.FXSEL(Fox::SEL_MOTION, 0), evt)
  end
end
doMouseWheel() click to toggle source
# File lib/fox16/pseudomouse.rb, line 30
def doMouseWheel
  unless @target.nil?
    evt = FXEvent.new
    evt.type = Fox::SEL_MOUSEWHEEL
    @target.handle(self, Fox.FXSEL(Fox::SEL_MOUSEWHEEL, 0), evt)
  end
end
doRightButtonPress() click to toggle source
# File lib/fox16/pseudomouse.rb, line 70
def doRightButtonPress
  unless @target.nil?
    evt = FXEvent.new
    evt.type = Fox::SEL_RIGHTBUTTONPRESS
    @target.handle(self, Fox.FXSEL(Fox::SEL_RIGHTBUTTONPRESS, 0), evt)
  end
end
doRightButtonRelease() click to toggle source
# File lib/fox16/pseudomouse.rb, line 78
def doRightButtonRelease
  unless @target.nil?
    evt = FXEvent.new
    evt.type = Fox::SEL_RIGHTBUTTONRELEASE
    @target.handle(self, Fox.FXSEL(Fox::SEL_RIGHTBUTTONRELEASE, 0), evt)
  end
end