Class: Glimmer::SWT::Custom::Shape::Point

Inherits:
Glimmer::SWT::Custom::Shape show all
Includes:
PathSegment
Defined in:
lib/glimmer/swt/custom/shape/point.rb

Constant Summary

Constants inherited from Glimmer::SWT::Custom::Shape

String

Instance Attribute Summary

Attributes inherited from Glimmer::SWT::Custom::Shape

#args, #drawable, #extent, #name, #options, #parent, #properties, #shapes

Instance Method Summary collapse

Methods included from PathSegment

#add_to_geometry, #add_to_swt_path, #default_connected_path_segment_arg_count, #default_path_segment_arg_count, #dispose, #first_path_segment?, #part_of_path?, #path, #previous_path_segment, #root_path

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, #bounds, #calculate_args!, #calculate_paint_args!, #calculated_args?, #calculated_args_changed!, #calculated_args_changed_for_defaults!, #calculated_height, #calculated_paint_args_changed!, #calculated_width, #calculated_x, #calculated_y, #can_handle_observation_request?, #center_x, #center_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, #drag_and_move, #drag_and_move=, #drag_source, #drag_source=, #draw?, drop_shapes, #ensure_extent, #expanded_shapes, #fill?, flyweight_method_names, flyweight_patterns, #foreground_pattern_args, gc_instance_methods, #get_attribute, #get_data, #get_parameter_attribute, #gradient?, #handle_observation_request, #has_attribute?, #has_some_background?, #has_some_foreground?, #height_delta, #height_delta=, #include_with_children?, #initialize, #inspect, #inverse_transform_point, #irregular?, 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?, #rotate, #rotation_angle, #round?, #set_attribute, #set_data, #set_parameter_attribute, #size, #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

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


78
79
80
# File 'lib/glimmer/swt/custom/shape/point.rb', line 78

def eql?(other)
  other.is_a?(Point) && x == (other && other.respond_to?(:x) && other.x) && y == (other && other.respond_to?(:y) && other.y)
end

#hashObject



83
84
85
# File 'lib/glimmer/swt/custom/shape/point.rb', line 83

def hash
  [x, y].hash
end

#heightObject



47
48
49
# File 'lib/glimmer/swt/custom/shape/point.rb', line 47

def height
  1
end

#include?(x, y) ⇒ Boolean Also known as: contain?

Returns:

  • (Boolean)


51
52
53
54
55
# File 'lib/glimmer/swt/custom/shape/point.rb', line 51

def include?(x, y)
  x, y = inverse_transform_point(x, y)
  # give it some fuzz (helps makes mouse clicking easier)
  x.to_i.between?(self.absolute_x.to_i - 2, self.absolute_x.to_i + 2) && y.to_i.between?(self.absolute_y.to_i - 2, self.absolute_y.to_i + 2)
end

#parameter_namesObject



39
40
41
# File 'lib/glimmer/swt/custom/shape/point.rb', line 39

def parameter_names
  [:x, :y]
end

#path_segment_argsObject



62
63
64
# File 'lib/glimmer/swt/custom/shape/point.rb', line 62

def path_segment_args
  @args + [1, 1]
end

#path_segment_geometry_argsObject



70
71
72
# File 'lib/glimmer/swt/custom/shape/point.rb', line 70

def path_segment_geometry_args
  @args
end

#path_segment_geometry_method_nameObject



66
67
68
# File 'lib/glimmer/swt/custom/shape/point.rb', line 66

def path_segment_geometry_method_name
  'moveTo'
end

#path_segment_method_nameObject



58
59
60
# File 'lib/glimmer/swt/custom/shape/point.rb', line 58

def path_segment_method_name
  'addRectangle'
end

#previous_point_connected?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/glimmer/swt/custom/shape/point.rb', line 74

def previous_point_connected?
  false
end

#widthObject



43
44
45
# File 'lib/glimmer/swt/custom/shape/point.rb', line 43

def width
  1
end