Class: ATSPI::Accessible::Children

Inherits:
Object
  • Object
show all
Includes:
SelectableCollection
Defined in:
lib/atspi/accessible/children.rb

Overview

Wraps the children part of libatspi’s AtspiAccessible and parts of AtspiSelection.

Direct Known Subclasses

Table::Cells

Defined Under Namespace

Classes: Selected

Enumerable interface collapse

Selection collapse

Representation collapse

Instance Method Details

#[](idx) ⇒ Object Originally defined in module Collection

alias for #at

#at(idx) ⇒ Accessible

Returns its child at index idx.

Parameters:

  • idx (Integer)

Returns:

See Also:



18
19
20
21
22
# File 'lib/atspi/accessible/children.rb', line 18

def at(idx)
  super do |mapped_idx|
    Accessible.new(@native.child_at_index(mapped_idx))
  end
end

#countInteger

Returns its number of children.

Returns:

  • (Integer)

    its number of children

See Also:



27
28
29
# File 'lib/atspi/accessible/children.rb', line 27

def count
  @native.child_count
end

#deselect_alltrue, false

Tries to deselect all children

Returns:

  • (true, false)

    indicates success

See Also:



67
68
69
# File 'lib/atspi/accessible/children.rb', line 67

def deselect_all
  selectable? and @native.clear_selection
end

#eachObject Originally defined in module Collection

prerequisite for Enumerable

#inspectString Originally defined in module SelectableCollection

Returns instance as inspectable string.

Returns:

  • (String)

    instance as inspectable string

#last(n = 1) ⇒ Object+ Originally defined in module Collection

Returns item(s) from the end.

Parameters:

  • n (Integer) (defaults to: 1)

    number of items to return

Returns:

  • (Object, Array<Object>)

    item(s) from the end

#lengthObject Originally defined in module Collection

alias for #count

#select_alltrue, false

Tries to select all children

Returns:

  • (true, false)

    indicates success

See Also:



58
59
60
# File 'lib/atspi/accessible/children.rb', line 58

def select_all
  selectable? and @native.select_all
end

#selectable?true, false

Checks if the accessible the children belong to implements the selection interface.

Returns:

  • (true, false)

See Also:



39
40
41
# File 'lib/atspi/accessible/children.rb', line 39

def selectable?
  not @native.selection_iface.nil?
end

#selectedSelected, []

Returns its selected subset. It will be an empty array if children are not selectable.

Returns:

  • (Selected, [])

    its selected subset. It will be an empty array if children are not selectable.



45
46
47
48
49
50
51
# File 'lib/atspi/accessible/children.rb', line 45

def selected
  if selectable?
    Selected.new(@native)
  else
    []
  end
end

#sizeObject Originally defined in module Collection

alias for #count