Class: Wx::SF::OpenArrow
- Defined in:
- lib/wx/shapes/arrows/open_arrow.rb
Overview
Class extends the Wx::LineArrow class and encapsulates arrow shape consisting of single two lines leading from the end of the parent line shape.
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#draw(from, to, dc) ⇒ Wx::Point
Translated connection point for arrow.
-
#initialize(parent = nil) ⇒ OpenArrow
constructor
Constructor.
- #scale ⇒ Object protected
Methods inherited from LineArrow
#get_pen, #get_pen_width, #set_parent_shape, #set_pen
Methods inherited from ArrowBase
#get_parent_shape, #set_parent_shape, #translate_arrow
Constructor Details
#initialize(parent = nil) ⇒ OpenArrow
Constructor
22 23 24 25 |
# File 'lib/wx/shapes/arrows/open_arrow.rb', line 22 def initialize(parent=nil) super(parent) scale end |
Class Method Details
Instance Method Details
#draw(from, to, dc) ⇒ Wx::Point
Returns translated connection point for arrow.
43 44 45 46 47 48 49 50 51 |
# File 'lib/wx/shapes/arrows/open_arrow.rb', line 43 def draw(from, to, dc) tip, wing1, wing2, cp = translate_arrow(vertices, from, to) dc.with_pen(pen) do |dc| dc.draw_line(tip, wing1) dc.draw_line(tip, wing2) dc.draw_line(tip, cp) end cp end |
#scale ⇒ Object (protected)
32 33 34 35 |
# File 'lib/wx/shapes/arrows/open_arrow.rb', line 32 def scale @vertices = nil @ratio = 1 + (pen_width / 2) * 0.5 end |