Class: Glimmer::SWT::Custom::Shape::Arc
- Inherits:
-
Glimmer::SWT::Custom::Shape
- Object
- Glimmer::SWT::Custom::Shape
- Glimmer::SWT::Custom::Shape::Arc
- Defined in:
- lib/glimmer/swt/custom/shape/arc.rb
Constant Summary
Constants inherited from Glimmer::SWT::Custom::Shape
Instance Attribute Summary
Attributes inherited from Glimmer::SWT::Custom::Shape
#args, #drawable, #extent, #name, #options, #parent, #properties, #shapes
Instance Method Summary collapse
- #bounds ⇒ Object
-
#contain?(x, y) ⇒ Boolean
checks if shape contains the point denoted by x and y.
- #geometry ⇒ Object
- #include?(x, y) ⇒ Boolean
- #irregular? ⇒ Boolean
- #parameter_names ⇒ Object
- #size ⇒ Object
Methods inherited from Glimmer::SWT::Custom::Shape
#absolute_x, #absolute_y, #add_shape, #all_parent_properties, #amend_method_name_options_based_on_properties!, #apply_property_arg_conversions, #apply_shape_arg_conversions!, #apply_shape_arg_defaults!, arg_options, #background_pattern_args, #calculate_args!, #calculate_paint_args!, #calculated_args?, #calculated_args_changed!, #calculated_args_changed_for_defaults!, #calculated_height, #calculated_width, #calculated_x, #calculated_y, #clear_shapes, #composite?, #container?, #content, #convert_properties!, #converted_properties, create, #current_parameter_name?, #default_height, #default_height?, #default_width, #default_width?, #default_x, #default_x?, #default_y, #default_y?, #dispose, #draw?, #ensure_extent, #expanded_shapes, #fill?, flyweight_method_names, flyweight_patterns, #foreground_pattern_args, gc_instance_methods, #get_attribute, #get_data, #get_parameter_attribute, #gradient?, #has_attribute?, #has_some_background?, #has_some_foreground?, #height_delta, #height_delta=, #initialize, #inspect, keywords, #location, #location_parameter_names, #max_height, #max_height?, #max_width, #max_width?, #method_missing, method_name, #move_by, #paint, #paint_children, #paint_self, #parameter_index, #parameter_name?, #parent_shape_composites, #parent_shape_containers, #parent_shapes, pattern, #pattern, #pattern_args, #possible_parameter_names, #post_add_content, #respond_to?, #round?, #set_attribute, #set_data, #set_parameter_attribute, #tolerate_shape_extra_args!, valid?, #width_delta, #width_delta=, #x_delta, #x_delta=, #x_end, #y_delta, #y_delta=, #y_end
Methods included from Properties
attribute_getter, #attribute_getter, attribute_setter, #attribute_setter, normalized_attribute, #normalized_attribute, ruby_attribute_getter, #ruby_attribute_setter, ruby_attribute_setter
Constructor Details
This class inherits a constructor from Glimmer::SWT::Custom::Shape
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Glimmer::SWT::Custom::Shape
Instance Method Details
#bounds ⇒ Object
40 41 42 43 |
# File 'lib/glimmer/swt/custom/shape/arc.rb', line 40 def bounds shape_bounds = geometry.getBounds2D org.eclipse.swt.graphics.Rectangle.new(shape_bounds.x, shape_bounds.y, shape_bounds.width, shape_bounds.height) end |
#contain?(x, y) ⇒ Boolean
checks if shape contains the point denoted by x and y
55 56 57 |
# File 'lib/glimmer/swt/custom/shape/arc.rb', line 55 def contain?(x, y) geometry.contains(x, y) end |
#geometry ⇒ Object
50 51 52 |
# File 'lib/glimmer/swt/custom/shape/arc.rb', line 50 def geometry java.awt.geom.Arc2D::Double.new(self.absolute_x, self.absolute_y, calculated_width, calculated_height, start_angle, arc_angle, java.awt.geom.Arc2D::PIE) end |
#include?(x, y) ⇒ Boolean
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/glimmer/swt/custom/shape/arc.rb', line 59 def include?(x, y) if filled? contain?(x, y) else # give it some fuzz to allow a larger region around the drawn oval to accept including a point (helps with mouse clickability on a shape) outer_shape_geometry = java.awt.geom.Arc2D::Double.new(self.absolute_x, self.absolute_y, calculated_width + 3, calculated_height + 3, start_angle, arc_angle, java.awt.geom.Arc2D::PIE) inner_shape_geometry = java.awt.geom.Arc2D::Double.new(self.absolute_x, self.absolute_y, calculated_width - 3, calculated_height - 3, start_angle, arc_angle, java.awt.geom.Arc2D::PIE) outer_shape_geometry.contains(x, y) && !inner_shape_geometry.contains(x, y) end end |
#irregular? ⇒ Boolean
70 71 72 |
# File 'lib/glimmer/swt/custom/shape/arc.rb', line 70 def irregular? true end |
#parameter_names ⇒ Object
36 37 38 |
# File 'lib/glimmer/swt/custom/shape/arc.rb', line 36 def parameter_names [:x, :y, :width, :height, :start_angle, :arc_angle] end |
#size ⇒ Object
45 46 47 48 |
# File 'lib/glimmer/swt/custom/shape/arc.rb', line 45 def size shape_bounds = geometry.getBounds2D org.eclipse.swt.graphics.Point.new(shape_bounds.width, shape_bounds.height) end |