Class: Wx::SF::SolidArrow
- Inherits:
-
FilledArrow
- Object
- ArrowBase
- LineArrow
- FilledArrow
- Wx::SF::SolidArrow
- Defined in:
- lib/wx/shapes/arrows/solid_arrow.rb
Overview
Class extends the Wx::FilledArrow class and encapsulates solid arrow shapes.
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) ⇒ SolidArrow
constructor
Constructor.
- #scale ⇒ Object protected
- #vertices ⇒ Object protected
Methods inherited from FilledArrow
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) ⇒ SolidArrow
Constructor
21 22 23 24 |
# File 'lib/wx/shapes/arrows/solid_arrow.rb', line 21 def initialize(parent=nil) super scale end |
Class Method Details
Instance Method Details
#draw(from, to, dc) ⇒ Wx::Point
Returns translated connection point for arrow.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/wx/shapes/arrows/solid_arrow.rb', line 42 def draw(from, to, dc) rarrow = translate_arrow(vertices, from, to) cp = rarrow.pop # get connection point dc.with_pen(pen) do |dc| dc.with_brush(fill) do |dc| dc.draw_polygon(rarrow) end end cp end |
#scale ⇒ Object (protected)
31 32 33 34 |
# File 'lib/wx/shapes/arrows/solid_arrow.rb', line 31 def scale @vertices = nil @ratio = 1 + (pen_width / 2) * 0.5 end |
#vertices ⇒ Object (protected)
26 27 28 |
# File 'lib/wx/shapes/arrows/solid_arrow.rb', line 26 def vertices @vertices ||= SolidArrow.arrow(@ratio) end |