Class: Shoes::Swt::Shape
Instance Attribute Summary collapse
#pass_coordinates
Instance Method Summary
collapse
-
#arc_to(x, y, width, height, start_angle, arc_angle) ⇒ Object
-
#curve_to(cx1, cy1, cx2, cy2, x, y) ⇒ Object
-
#dispose ⇒ Object
-
#height ⇒ Object
(also: #element_height)
-
#initialize(dsl, app) ⇒ Shape
constructor
Creates a new Shoes::Swt::Shape.
-
#left ⇒ Object
(also: #absolute_left, #element_left)
-
#line_to(x, y) ⇒ Object
-
#move_to(x, y) ⇒ Object
-
#redraw_target ⇒ Object
-
#top ⇒ Object
(also: #absolute_top, #element_top)
-
#transform ⇒ Object
-
#update_position ⇒ Object
-
#width ⇒ Object
(also: #element_width)
#update_stroke
#update_fill
#remove
#hidden?, #hidden_from_view?, #hide, #outside_parent_view?, #show, #toggle, #visible?
#click, #pass_coordinates?, #register_click, #release
Constructor Details
#initialize(dsl, app) ⇒ Shape
Creates a new Shoes::Swt::Shape
17
18
19
20
21
22
23
24
25
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 17
def initialize(dsl, app)
@dsl = dsl
@app = app
@element = ::Swt::Path.new(::Swt.display)
@painter = ShapePainter.new(self)
@transform = nil
@app.add_paint_listener @painter
@scroll_top_applied = nil
end
|
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
32
33
34
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 32
def app
@app
end
|
#dsl ⇒ Object
Returns the value of attribute dsl.
32
33
34
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 32
def dsl
@dsl
end
|
#element ⇒ Object
Returns the value of attribute element.
32
33
34
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 32
def element
@element
end
|
#painter ⇒ Object
Returns the value of attribute painter.
32
33
34
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 32
def painter
@painter
end
|
Returns the value of attribute scroll_top_applied.
33
34
35
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 33
def scroll_top_applied
@scroll_top_applied
end
|
Instance Method Details
#arc_to(x, y, width, height, start_angle, arc_angle) ⇒ Object
51
52
53
54
55
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 51
def arc_to(x, y, width, height, start_angle, arc_angle)
@element.add_arc(x - (width / 2), y - (height / 2), width, height,
-start_angle * 180 / ::Shoes::PI,
(start_angle - arc_angle) * 180 / ::Shoes::PI)
end
|
#curve_to(cx1, cy1, cx2, cy2, x, y) ⇒ Object
47
48
49
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 47
def curve_to(cx1, cy1, cx2, cy2, x, y)
@element.cubic_to(cx1, cy1, cx2, cy2, x, y)
end
|
#dispose ⇒ Object
27
28
29
30
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 27
def dispose
@transform.dispose unless @transform.nil? || @transform.disposed?
@element.dispose unless @element.nil? || @element.disposed?
end
|
#height ⇒ Object
Also known as:
element_height
79
80
81
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 79
def height
native_height
end
|
#left ⇒ Object
Also known as:
absolute_left, element_left
62
63
64
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 62
def left
native_left
end
|
#line_to(x, y) ⇒ Object
39
40
41
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 39
def line_to(x, y)
@element.line_to(x, y)
end
|
#move_to(x, y) ⇒ Object
43
44
45
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 43
def move_to(x, y)
@element.move_to(x, y)
end
|
#redraw_target ⇒ Object
35
36
37
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 35
def redraw_target
@dsl
end
|
#top ⇒ Object
Also known as:
absolute_top, element_top
66
67
68
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 66
def top
native_top
end
|
86
87
88
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 86
def transform
@transform ||= ::Swt::Transform.new(::Swt.display)
end
|
#update_position ⇒ Object
57
58
59
60
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 57
def update_position
transform.translate(dsl.translate_left + (dsl.element_left || 0),
dsl.translate_top + (dsl.element_top || 0))
end
|
#width ⇒ Object
Also known as:
element_width
75
76
77
|
# File 'shoes-swt/lib/shoes/swt/shape.rb', line 75
def width
native_width
end
|