Class: Glimmer::LibUI::Shape::Circle

Inherits:
Glimmer::LibUI::Shape show all
Defined in:
lib/glimmer/libui/shape/circle.rb

Constant Summary

Constants inherited from Glimmer::LibUI::Shape

KEYWORD_ALIASES

Instance Attribute Summary

Attributes inherited from Glimmer::LibUI::Shape

#args, #block, #content_added, #keyword, #parent

Instance Method Summary collapse

Methods inherited from Glimmer::LibUI::Shape

#absolute_c1_x, #absolute_c1_y, #absolute_c2_x, #absolute_c2_y, #absolute_end_x, #absolute_end_y, #absolute_point_array, #absolute_x, #absolute_x_center, #absolute_y, #absolute_y_center, #area_proxy, #can_handle_listener?, #composite_shape, constant_symbol, #content, create, #destroy, exists?, #fill, #handle_listener, #implicit_path?, #initialize, #method_missing, parameter_defaults, parameters, #path_proxy, #post_add_content, #post_initialize_child, #redraw, #request_auto_redraw, #respond_to?, shape_class, #stroke, #transform

Methods included from DataBindable

#data_bind, #data_bind_read, #data_bind_write, #data_binding_model_attribute_observer_registrations

Methods included from PerfectShaped

#bounding_box, #contain?, #include?, #move

Methods included from Parent

#children, #post_initialize_child

Constructor Details

This class inherits a constructor from Glimmer::LibUI::Shape

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Glimmer::LibUI::Shape

Instance Method Details

#draw(area_draw_params) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/glimmer/libui/shape/circle.rb', line 31

def draw(area_draw_params)
  arc_args = @args.dup
  arc_args[3] = 0
  arc_args[4] = Math::PI * 2.0
  arc_args[5] = 0
  if parent.is_a?(Figure) && parent.x.nil? && parent.y.nil?
    ::LibUI.draw_path_new_figure_with_arc(path_proxy.libui, *arc_args)
  else
    if OS.windows? && parent.children.find {|child| child.is_a?(Circle)} == self
      ::LibUI.draw_path_new_figure_with_arc(path_proxy.libui, *arc_args)
    else
      ::LibUI.draw_path_arc_to(path_proxy.libui, *arc_args)
    end
  end
  super
end

#move_by(x_delta, y_delta) ⇒ Object



48
49
50
51
# File 'lib/glimmer/libui/shape/circle.rb', line 48

def move_by(x_delta, y_delta)
  self.x_center += x_delta
  self.y_center += y_delta
end

#perfect_shapeObject



53
54
55
56
57
58
59
60
61
# File 'lib/glimmer/libui/shape/circle.rb', line 53

def perfect_shape
  require 'perfect-shape'
  the_perfect_shape_dependencies = perfect_shape_dependencies
  if the_perfect_shape_dependencies != @perfect_shape_dependencies
    absolute_x_center, absolute_y_center, radius = @perfect_shape_dependencies = the_perfect_shape_dependencies
    @perfect_shape = PerfectShape::Circle.new(center_x: absolute_x_center, center_y: absolute_y_center, radius: radius)
  end
  @perfect_shape
end

#perfect_shape_dependenciesObject



63
64
65
# File 'lib/glimmer/libui/shape/circle.rb', line 63

def perfect_shape_dependencies
  [absolute_x_center, absolute_y_center, radius]
end