class Fox::Canvas::TextShape
Attributes
font[R]
height[RW]
text[R]
width[RW]
Public Class Methods
new(x, y, w, h, text=nil)
click to toggle source
Calls superclass method
Fox::Canvas::Shape::new
# File lib/fox16/canvas.rb, line 249 def initialize(x, y, w, h, text=nil) super(x, y) @width = w @height = h @text = text @font = FXApp.instance.normalFont end
Public Instance Methods
draw(dc)
click to toggle source
# File lib/fox16/canvas.rb, line 257 def draw(dc) old_foreground = dc.foreground apply_dc(dc) do if selected? dc.lineWidth = 5 dc.drawRectangle(x - 3, y - 3, width + 6, height + 6) end old_background = dc.background dc.background = old_foreground oldTextFont = dc.font dc.font = @font dc.drawImageText(x, y + height, text) dc.font = oldTextFont if oldTextFont dc.background = old_foreground end end