class Fox::Canvas::Shape
Attributes
foreground[RW]
selector[RW]
target[RW]
x[RW]
y[RW]
Public Class Methods
new(x, y)
click to toggle source
# File lib/fox16/canvas.rb, line 26 def initialize(x, y) @enabled = true @visible = true @selected = false @draggable = false @x = x @y = y @foreground = FXRGB(0, 0, 0) @target = nil @selector = 0 end
Public Instance Methods
bounds()
click to toggle source
Return the bounding box for this shape
# File lib/fox16/canvas.rb, line 39 def bounds FXRectangle.new(x, y, width, height) end
deselect()
click to toggle source
Deselect this shape
# File lib/fox16/canvas.rb, line 99 def deselect @selected = false end
disable()
click to toggle source
Disable this shape
# File lib/fox16/canvas.rb, line 69 def disable @enabled = false end
draggable=(d)
click to toggle source
Set this shape's draggability
# File lib/fox16/canvas.rb, line 109 def draggable=(d) @draggable = d end
draggable?()
click to toggle source
Is this shape draggable?
# File lib/fox16/canvas.rb, line 114 def draggable? @draggable end
draw(dc)
click to toggle source
Draw this shape into the specificed device context
# File lib/fox16/canvas.rb, line 119 def draw(dc) end
drawOutline(dc, x, y, w, h)
click to toggle source
Draws outline
# File lib/fox16/canvas.rb, line 123 def drawOutline(dc, x, y, w, h) points = [] points << FXPoint.new(x - 0.5*w, y - 0.5*h) points << FXPoint.new(x + 0.5*w, y) points << FXPoint.new(x + 0.5*w, y + 0.5*h) points << FXPoint.new(x - 0.5*w, y + 0.5*h) points << points[0] dc.drawLines(points) end
enable()
click to toggle source
Enable this shape
# File lib/fox16/canvas.rb, line 64 def enable @enabled = true end
enabled?()
click to toggle source
Is this shape enabled?
# File lib/fox16/canvas.rb, line 74 def enabled? @enabled end
hide()
click to toggle source
Hide this shape
# File lib/fox16/canvas.rb, line 84 def hide @visible = false end
hit?(xpos, ypos)
click to toggle source
Hit test
# File lib/fox16/canvas.rb, line 44 def hit?(xpos, ypos) (xpos >= x) && (xpos < x+width) && (ypos >= y) && (ypos < y+height) end
makeControlPoints()
click to toggle source
Default: make 6 control points
# File lib/fox16/canvas.rb, line 134 def makeControlPoints end
move(x, y)
click to toggle source
Move shape to specified position
# File lib/fox16/canvas.rb, line 49 def move(x, y) @x, @y = x, y end
position(x, y, w, h)
click to toggle source
Move and resize the shape
# File lib/fox16/canvas.rb, line 58 def position(x, y, w, h) move(x, y) resize(w, h) end
resize(w, h)
click to toggle source
Resize shape to specified width and height
# File lib/fox16/canvas.rb, line 54 def resize(w, h) end
select()
click to toggle source
Select this shape
# File lib/fox16/canvas.rb, line 94 def select @selected = true end
selected?()
click to toggle source
Is this shape selected?
# File lib/fox16/canvas.rb, line 104 def selected? @selected end
show()
click to toggle source
Show this shape
# File lib/fox16/canvas.rb, line 79 def show @visible = true end
visible?()
click to toggle source
Is this shape visible?
# File lib/fox16/canvas.rb, line 89 def visible? @visible end