Module: ATSPI::Accessible::Extents
- Included in:
- ATSPI::Accessible, ErrorAccessible
- Defined in:
- lib/atspi/accessible/extents.rb
Overview
Wraps libatspi’s AtspiComponent
Attributes & States collapse
-
#contains?(x, y, relative_to:) ⇒ true, false
Checks if the given point lies within its bounds.
-
#extends? ⇒ true, false
Checks if it is extending, that is it has a position and size.
-
#extents(relative_to:) ⇒ ATSPI::Extents
Its extents.
-
#layer ⇒ Symbol
Its layer derived from libatspi’s AtspiComponentLayer enum by removing the prefix
ATSPI_LAYER_and making it lowercase. -
#mdi_z_order ⇒ Integer
Its mdi_z_order.
-
#opacity ⇒ Float
(also: #alpha)
Its opacity between
0.0(transparent) and1.0(opaque).
Actions collapse
-
#grab_focus ⇒ true, false
Sets the input focus to it.
Tree & Traversal collapse
-
#descendant_at(x, y, relative_to:) ⇒ Accessible?
The descendant at the given coordinates.
Instance Method Details
#contains?(x, y, relative_to:) ⇒ true, false
Checks if the given point lies within its bounds
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.
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.
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.
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_focus ⇒ true, false
Sets the input focus to it.
47 48 49 |
# File 'lib/atspi/accessible/extents.rb', line 47 def grab_focus extends? and @native.grab_focus end |
#layer ⇒ Symbol
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.
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_order ⇒ Integer
Returns its mdi_z_order. -1 if it does not implement the component interface.
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 |
#opacity ⇒ Float 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.
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 |