lib/wx/shapes/shapes/ellipse_shape.rb in wxruby3-shapes-0.9.0.pre.beta.3 vs lib/wx/shapes/shapes/ellipse_shape.rb in wxruby3-shapes-0.9.5
- old
+ new
@@ -4,18 +4,15 @@
module Wx::SF
# Class encapsulating the ellipse shape. It extends the basic rectangular shape.
class EllipseShape < RectShape
- # @overload initialize()
- # Default constructor.
- # @overload initialize(pos, size, diagram)
- # User constructor.
- # @param [Wx::RealPoint] pos Initial position
- # @param [Wx::RealPoint] size Initial size
- # @param [Wx::SF::Diagram] diagram parent diagram
- def initialize(*args)
+ # Constructor.
+ # @param [Wx::RealPoint,Wx::Point] pos Initial position
+ # @param [Wx::RealPoint,Wx::Size,Wx::Point] size Initial size
+ # @param [Wx::SF::Diagram] diagram parent diagram
+ def initialize(pos = Shape::DEFAULT::POSITION, size = RectShape::DEFAULT::SIZE, diagram: nil)
super
end
# Test whether the given point is inside the shape. The function
# can be overridden if necessary.
@@ -56,43 +53,43 @@
protected
# Draw the shape in the normal way. The function can be overridden if necessary.
# @param [Wx::DC] dc Reference to device context where the shape will be drawn to
def draw_normal(dc)
- dc.with_pen(@border) do
- dc.with_brush(@fill) do
+ dc.with_pen(border) do
+ dc.with_brush(fill) do
dc.draw_ellipse(get_absolute_position.to_point, @rect_size.to_size)
end
end
end
# Draw the shape in the hover mode (the mouse cursor is above the shape).
# The function can be overridden if necessary.
# @param [Wx::DC] dc Reference to device context where the shape will be drawn to
def draw_hover(dc)
- dc.with_pen(Wx::Pen.new(@hover_color, 1)) do
- dc.with_brush(@fill) do
+ dc.with_pen(Wx::Pen.new(hover_colour, 1)) do
+ dc.with_brush(fill) do
dc.draw_ellipse(get_absolute_position.to_point, @rect_size.to_size)
end
end
end
# Draw the shape in the highlighted mode (another shape is dragged over this
# shape and this shape will accept the dragged one if it will be dropped on it).
# The function can be overridden if necessary.
# @param [Wx::DC] dc Reference to device context where the shape will be drawn to
def draw_highlighted(dc)
- dc.with_pen(Wx::Pen.new(@hover_color, 2)) do
- dc.with_brush(@fill) do
+ dc.with_pen(Wx::Pen.new(hover_colour, 2)) do
+ dc.with_brush(fill) do
dc.draw_ellipse(get_absolute_position.to_point, @rect_size.to_size)
end
end
end
# Draw shadow under the shape. The function can be overridden if necessary.
# @param [Wx::DC] dc Reference to device context where the shadow will be drawn to
def draw_shadow(dc)
- if @fill.style != Wx::BrushStyle::BRUSHSTYLE_TRANSPARENT
+ if fill.style != Wx::BrushStyle::BRUSHSTYLE_TRANSPARENT
dc.with_pen(Wx::TRANSPARENT_PEN) do
dc.with_brush(get_parent_canvas.get_shadow_fill) do
dc.draw_ellipse((get_absolute_position + get_parent_canvas.get_shadow_offset).to_point,
@rect_size.to_size)
end