Class: Wx::SF::LineArrow

Inherits:
ArrowBase show all
Defined in:
lib/wx/shapes/arrows/line_arrow.rb

Overview

Class extends the Wx::ArrowBase class and encapsulates line drawn arrow shapes. The shapes are automatically scaled based on the line width used.

Direct Known Subclasses

CrossBarArrow, CupArrow, FilledArrow, OpenArrow

Instance Method Summary collapse

Methods inherited from ArrowBase

#draw, #get_parent_shape, #translate_arrow

Constructor Details

#initialize(parent = nil) ⇒ LineArrow

Constructor

Parameters:



17
18
19
20
# File 'lib/wx/shapes/arrows/line_arrow.rb', line 17

def initialize(parent=nil)
  super
  @pen = nil
end

Instance Method Details

#get_penWx::Pen? Also known as: pen

Get arrow border pen

Returns:



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

def get_pen
  @pen || @parent_shape&.line_pen
end

#get_pen_widthInteger Also known as: pen_width

Return current pen width.

Returns:

  • (Integer)


39
40
41
# File 'lib/wx/shapes/arrows/line_arrow.rb', line 39

def get_pen_width
  get_pen&.width || 1
end

#scaleObject (protected)

Scale the arrow. Does nothing by default.



54
55
56
# File 'lib/wx/shapes/arrows/line_arrow.rb', line 54

def scale
  # noop
end

#set_parent_shape(parent) ⇒ Object Also known as: parent_shape=

Set a parent of the arrow shape.

Parameters:



46
47
48
49
# File 'lib/wx/shapes/arrows/line_arrow.rb', line 46

def set_parent_shape(parent)
  super
  scale
end

#set_pen(pen) ⇒ Object Also known as: pen=

Set arrow border pen (when nil restore the default).

Parameters:



31
32
33
34
# File 'lib/wx/shapes/arrows/line_arrow.rb', line 31

def set_pen(pen)
  @pen = pen
  scale
end