Class: Glimmer::SWT::Custom::Shape::Rectangle
Constant Summary
String
Instance Attribute Summary
#args, #disposed, #drawable, #extent, #name, #options, #parent, #properties, #shapes, #widget_listener_proxies
Instance Method Summary
collapse
#absolute_x, #absolute_y, #add_shape, #all_parent_properties, #amend_method_name_options_based_on_properties!, #any_potential_drop_targets?, #apply_property_arg_conversions, #apply_shape_arg_conversions!, #apply_shape_arg_defaults!, arg_options, #background_pattern_args, #bounds, #bounds_contain?, #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?, #cancel_dragging!, #center_x, #center_y, #clear_shapes, #composite?, #contain?, #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?, #deregister_drag_listeners, #dispose, #drag_and_move, #drag_and_move=, #drag_source, #drag_source=, #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?, #handle_observation_request, #has_attribute?, #has_some_background?, #has_some_foreground?, #height_delta, #height_delta=, #include_shape?, #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, #post_add_content, #remove_shape_disposed_listener, #respond_to?, #rotate, #rotation_angle, #round?, #set_attribute, #set_data, #shell_proxy, #size, #tolerate_shape_extra_args!, #transform_point, 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
Instance Method Details
#absolute_point_xy_array ⇒ Object
79
80
81
|
# File 'lib/glimmer/swt/custom/shape/rectangle.rb', line 79
def absolute_point_xy_array
[[absolute_x, absolute_y], [absolute_x + calculated_width, absolute_y], [absolute_x + calculated_width, absolute_y + calculated_height], [absolute_x, absolute_y + calculated_height]]
end
|
#include?(x, y) ⇒ Boolean
checks if drawn or filled rectangle includes the point denoted by x and y (if drawn, it only returns true if point lies on the edge)
84
85
86
87
88
89
90
91
92
|
# File 'lib/glimmer/swt/custom/shape/rectangle.rb', line 84
def include?(x, y)
if filled?
contain?(x, y)
else
x, y = inverse_transform_point(x, y)
comparison_lines = absolute_point_xy_array.zip(absolute_point_xy_array.rotate(1))
comparison_lines.any? {|line| Line.include?(line.first.first, line.first.last, line.last.first, line.last.last, x, y)}
end
end
|
#parameter_names ⇒ Object
35
36
37
|
# File 'lib/glimmer/swt/custom/shape/rectangle.rb', line 35
def parameter_names
@parameter_names || rectangle_parameter_names
end
|
#point_xy_array ⇒ Object
75
76
77
|
# File 'lib/glimmer/swt/custom/shape/rectangle.rb', line 75
def point_xy_array
[[x, y], [x + calculated_width, y], [x + calculated_width, y + calculated_height], [x, y + calculated_height]]
end
|
#possible_parameter_names ⇒ Object
39
40
41
42
|
# File 'lib/glimmer/swt/custom/shape/rectangle.rb', line 39
def possible_parameter_names
(rectangle_round_parameter_names + rectangle_gradient_parameter_names + rectangle_parameter_names + rectangle_rectangle_parameter_names).uniq
end
|
#rectangle_gradient_parameter_names ⇒ Object
48
49
50
|
# File 'lib/glimmer/swt/custom/shape/rectangle.rb', line 48
def rectangle_gradient_parameter_names
[:x, :y, :width, :height, :vertical]
end
|
#rectangle_parameter_names ⇒ Object
52
53
54
|
# File 'lib/glimmer/swt/custom/shape/rectangle.rb', line 52
def rectangle_parameter_names
[:x, :y, :width, :height]
end
|
#rectangle_rectangle_parameter_names ⇒ Object
56
57
58
59
|
# File 'lib/glimmer/swt/custom/shape/rectangle.rb', line 56
def rectangle_rectangle_parameter_names
[:rectangle]
end
|
#rectangle_round_parameter_names ⇒ Object
44
45
46
|
# File 'lib/glimmer/swt/custom/shape/rectangle.rb', line 44
def rectangle_round_parameter_names
[:x, :y, :width, :height, :arc_width, :arc_height]
end
|
#set_parameter_attribute(attribute_name, *args) ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/glimmer/swt/custom/shape/rectangle.rb', line 61
def set_parameter_attribute(attribute_name, *args)
return super if @parameter_names.to_a.map(&:to_s).include?(attribute_name.to_s)
if rectangle_parameter_names.map(&:to_s).include?(attribute_name.to_s)
@parameter_names = rectangle_parameter_names
elsif rectangle_round_parameter_names.map(&:to_s).include?(attribute_name.to_s)
@parameter_names = rectangle_round_parameter_names
elsif rectangle_gradient_parameter_names.map(&:to_s).include?(attribute_name.to_s)
@parameter_names = rectangle_gradient_parameter_names
elsif rectangle_rectangle_parameter_names.map(&:to_s).include?(attribute_name.to_s)
@parameter_names = rectangle_rectangle_parameter_names
end
super
end
|