Module: ATSPI::Accessible::Extents

Included in:
ATSPI::Accessible, ErrorAccessible
Defined in:
lib/atspi/accessible/extents.rb

Overview

Wraps libatspi’s AtspiComponent

Attributes & States collapse

Actions collapse

Tree & Traversal collapse

Instance Method Details

#contains?(x, y, relative_to:) ⇒ true, false

Checks if the given point lies within its bounds

Examples:

accessible.contains?(1243, 323, relative_to: :screen) # => true

Parameters:

  • x (Integer)
  • y (Integer)
  • relative_to (Symbol)

    coordinate system derived from libatspi’s AtspiCoordType enum by removing the prefix ATSPI_COORD_TYPE and making it lowercase

Returns:

  • (true, false)

See Also:



80
81
82
# File 'lib/atspi/accessible/extents.rb', line 80

def contains?(x, y, relative_to:)
  extends? and @native.contains(x, y, relative_to)
end

#descendant_at(x, y, relative_to:) ⇒ Accessible?

Returns the descendant at the given coordinates. nil if it does not implement the component interface.

Examples:

accessible.descendant_at(1243, 323, relative_to: :screen) # => #<ATSPI::Accessible:0x140839014 …>

Parameters:

  • x (Integer)
  • y (Integer)
  • relative_to (Symbol)

    coordinate system derived from libatspi’s AtspiCoordType enum by removing the prefix ATSPI_COORD_TYPE and making it lowercase

Returns:

See Also:



99
100
101
102
103
104
105
# File 'lib/atspi/accessible/extents.rb', line 99

def descendant_at(x, y, relative_to:)
  if extends?
    ATSPI::Accessible.new(@native.accessible_at_point(x, y, relative_to))
  else
    nil
  end
end

#extends?true, false

Checks if it is extending, that is it has a position and size. Accessibles implementing the component interface are extending.

Returns:

  • (true, false)


10
11
12
# File 'lib/atspi/accessible/extents.rb', line 10

def extends?
  not @native.component_iface.nil?
end

#extents(relative_to:) ⇒ ATSPI::Extents

Returns its extents. Will have a (0,0) position and a 0x0 size if it does not implement the component interface.

Examples:

accessible.extents(relative_to: :screen) # => #<ATSPI::Extents:0x10b62c814 @x=2192 @y=187 @width=655 @height=492>

Parameters:

  • relative_to (Symbol)

    coordinate system derived from libatspi’s AtspiCoordType enum by removing the prefix ATSPI_COORD_TYPE_ and making it lowercase

Returns:

See Also:



120
121
122
123
124
125
126
# File 'lib/atspi/accessible/extents.rb', line 120

def extents(relative_to:)
  if extends?
    ATSPI::Extents.new(@native.extents(relative_to))
  else
    ATSPI::Extents.new(Struct.new(:x, :y, :width, :height).new(0, 0, 0, 0))
  end
end

#grab_focustrue, false

Sets the input focus to it.

Returns:

  • (true, false)

    indicating success of the operation. false if it does not implement the component interface.

See Also:



47
48
49
# File 'lib/atspi/accessible/extents.rb', line 47

def grab_focus
  extends? and @native.grab_focus
end

#layerSymbol

Returns its layer derived from libatspi’s AtspiComponentLayer enum by removing the prefix ATSPI_LAYER_ and making it lowercase. :invalid if it does not implement the component interface.

Returns:

See Also:



19
20
21
22
23
24
25
# File 'lib/atspi/accessible/extents.rb', line 19

def layer
  if extends?
    @native.layer
  else
    :invalid
  end
end

#mdi_z_orderInteger

Returns its mdi_z_order. -1 if it does not implement the component interface.

Returns:

See Also:



31
32
33
34
35
36
37
# File 'lib/atspi/accessible/extents.rb', line 31

def mdi_z_order
  if extends?
    @native.mdi_z_order
  else
    -1
  end
end

#opacityFloat Also known as: alpha

Returns its opacity between 0.0 (transparent) and 1.0 (opaque). 0.0 if it does not implement the component interface.

Returns:

  • (Float)

    its opacity between 0.0 (transparent) and 1.0 (opaque). 0.0 if it does not implement the component interface.

See Also:



57
58
59
60
61
62
63
# File 'lib/atspi/accessible/extents.rb', line 57

def opacity
  if extends?
    @native.alpha
  else
    0.0
  end
end