Class: Wx::SF::CrossBarCircleArrow

Inherits:
CircleArrow show all
Defined in:
lib/wx/shapes/arrows/cross_bar_circle_arrow.rb

Overview

Class extends the Wx::CircleArrow class and encapsulates circle arrow shapes with a crossbar.

Constant Summary collapse

RADIUS =

Default circle radius.

4

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CircleArrow

#get_radius

Methods inherited from FilledArrow

#get_fill, #set_fill

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) ⇒ CrossBarCircleArrow

Constructor

Parameters:



24
25
26
27
# File 'lib/wx/shapes/arrows/cross_bar_circle_arrow.rb', line 24

def initialize(parent=nil)
  super
  scale
end

Class Method Details

.arrow(ratio) ⇒ Object



13
14
15
16
# File 'lib/wx/shapes/arrows/cross_bar_circle_arrow.rb', line 13

def arrow(ratio)
  x = ratio*6; y = ratio*6
  [Wx::RealPoint.new(x,y), Wx::RealPoint.new(x, -y), Wx::RealPoint.new(x, 0)]
end

Instance Method Details

#draw(from, to, dc) ⇒ Object

Draw arrow shape at the end of a virtual line.

Parameters:

  • from (Wx::RealPoint)

    Start of the virtual line

  • to (Wx::RealPoint)

    End of the virtual line

  • dc (Wx::DC)

    Device context for drawing



44
45
46
47
48
49
50
51
52
# File 'lib/wx/shapes/arrows/cross_bar_circle_arrow.rb', line 44

def draw(from, to, dc)
  dc.with_pen(pen) do |dc|
    bar_from, bar_to, bar_mid = translate_arrow(line, from, to)
    dc.draw_line(bar_from, bar_to)
    dc.draw_line(bar_mid, to.to_point)
    to = bar_mid
  end
  super(from, to, dc)
end

#scaleObject (protected)



34
35
36
37
# File 'lib/wx/shapes/arrows/cross_bar_circle_arrow.rb', line 34

def scale
  @line = nil
  super
end