Class: Fox::Canvas::TextShape
Instance Attribute Summary collapse
-
#font ⇒ Object
readonly
Returns the value of attribute font.
-
#height ⇒ Object
Returns the value of attribute height.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#width ⇒ Object
Returns the value of attribute width.
Attributes inherited from Shape
#foreground, #selector, #target, #x, #y
Instance Method Summary collapse
- #draw(dc) ⇒ Object
-
#initialize(x, y, w, h, text = nil) ⇒ TextShape
constructor
A new instance of TextShape.
Methods inherited from Shape
#apply_dc, #bounds, #deselect, #disable, #draggable=, #draggable?, #drawOutline, #enable, #enabled?, #hide, #hit?, #makeControlPoints, #move, #position, #resize, #select, #selected?, #show, #visible?
Constructor Details
Instance Attribute Details
#font ⇒ Object (readonly)
Returns the value of attribute font.
246 247 248 |
# File 'lib/fox16/canvas.rb', line 246 def font @font end |
#height ⇒ Object
Returns the value of attribute height.
247 248 249 |
# File 'lib/fox16/canvas.rb', line 247 def height @height end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
246 247 248 |
# File 'lib/fox16/canvas.rb', line 246 def text @text end |
#width ⇒ Object
Returns the value of attribute width.
247 248 249 |
# File 'lib/fox16/canvas.rb', line 247 def width @width end |
Instance Method Details
#draw(dc) ⇒ Object
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# 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 |