Class: Fox::Canvas::CircleShape

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, radius) ⇒ CircleShape

Returns a new instance of CircleShape.


280
281
282
283
# File 'lib/fox16/canvas.rb', line 280

def initialize(x, y, radius)
  super(x, y)
  @radius = radius
end

Instance Attribute Details

#radiusObject

Returns the value of attribute radius


278
279
280
# File 'lib/fox16/canvas.rb', line 278

def radius
  @radius
end

Instance Method Details

#draw(dc) ⇒ Object


293
294
295
296
297
298
299
300
301
# File 'lib/fox16/canvas.rb', line 293

def draw(dc)
  apply_dc(dc) do
    oldLineWidth = dc.lineWidth
    dc.lineWidth = 5 if selected?
    dc.drawArc(x, y, width, height,      0, 64*180)
    dc.drawArc(x, y, width, height, 64*180, 64*360)
    dc.lineWidth = oldLineWidth
  end
end

#heightObject


289
290
291
# File 'lib/fox16/canvas.rb', line 289

def height
  2*radius
end

#widthObject


285
286
287
# File 'lib/fox16/canvas.rb', line 285

def width
  2*radius
end