Class: Fox::Canvas::RectangleShape

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

Instance Attribute Summary collapse

Attributes inherited from Shape

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

Instance Method Summary collapse

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

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

Returns a new instance of RectangleShape.


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

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

Instance Attribute Details

#heightObject

Returns the value of attribute height.


228
229
230
# File 'lib/fox16/canvas.rb', line 228

def height
  @height
end

#widthObject

Returns the value of attribute width.


228
229
230
# File 'lib/fox16/canvas.rb', line 228

def width
  @width
end

Instance Method Details

#draw(dc) ⇒ Object


236
237
238
239
240
241
# File 'lib/fox16/canvas.rb', line 236

def draw(dc)
  apply_dc(dc) do
    dc.lineWidth = 5 if selected?
    dc.drawRectangle(x, y, width, height)
  end
end