Class: Fox::FXPseudoMouse
Overview
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
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from FXObject
#bind, #handle, #load, #save, subclasses
Constructor Details
Returns a new instance of FXPseudoMouse.
18
19
20
|
# File 'lib/fox16/pseudomouse.rb', line 18
def initialize(tgt=nil)
@target = tgt
end
|
Instance Attribute Details
#target ⇒ Object
Returns the value of attribute target.
16
17
18
|
# File 'lib/fox16/pseudomouse.rb', line 16
def target
@target
end
|
Instance Method Details
38
39
40
41
42
43
44
|
# 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
|
46
47
48
49
50
51
52
|
# 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
|
54
55
56
57
58
59
60
|
# 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
|
62
63
64
65
66
67
68
|
# 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 ⇒ Object
22
23
24
25
26
27
28
|
# 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 ⇒ Object
30
31
32
33
34
35
36
|
# 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
|
70
71
72
73
74
75
76
|
# 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
|
78
79
80
81
82
83
84
|
# 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
|