Class: Fox::Canvas::RectangleShape

Inherits:
Shape
  • Object
show all
Defined in:
lib/fox16/canvas.rb

Direct Known Subclasses

TextShape

Instance Attribute Summary collapse

Attributes inherited from Shape

#foreground, #selector, #target, #x, #y

Instance Method Summary collapse

Methods inherited from Shape

#bounds, #deselect, #disable, #draggable=, #draggable?, #drawOutline, #enable, #enabled?, #hide, #hit?, #makeControlPoints, #move, #position, #resize, #select, #selected?, #show, #visible?

Constructor Details

#initialize(x, y, w, h) ⇒ RectangleShape

Returns a new instance of RectangleShape


224
225
226
227
228
# File 'lib/fox16/canvas.rb', line 224

def initialize(x, y, w, h)
  super(x, y)
  @width = w
  @height = h
end

Instance Attribute Details

#heightObject

Returns the value of attribute height


222
223
224
# File 'lib/fox16/canvas.rb', line 222

def height
  @height
end

#widthObject

Returns the value of attribute width


222
223
224
# File 'lib/fox16/canvas.rb', line 222

def width
  @width
end

Instance Method Details

#draw(dc) ⇒ Object


230
231
232
233
234
235
# File 'lib/fox16/canvas.rb', line 230

def draw(dc)
  oldForeground = dc.foreground
  dc.foreground = foreground
  dc.drawRectangle(x, y, width, height)
  dc.foreground = oldForeground
end