Class: ATSPI::Accessible::Children
- Inherits:
-
Object
- Object
- ATSPI::Accessible::Children
- Includes:
- SelectableCollection
- Defined in:
- lib/atspi/accessible/children.rb
Overview
Wraps the children part of libatspi’s AtspiAccessible and parts of AtspiSelection.
Instance are enumerables supporting item access and can be treated more or less like an array.
Direct Known Subclasses
Defined Under Namespace
Classes: Selected
Enumerable interface collapse
-
#[](idx) ⇒ Object
included
from Collection
alias for #at.
-
#at(idx) ⇒ Accessible
Its child at index
idx. -
#count ⇒ Integer
Its number of children.
-
#each ⇒ Object
included
from Collection
prerequisite for Enumerable.
-
#last(n = 1) ⇒ Object+
included
from Collection
Item(s) from the end.
-
#length ⇒ Object
included
from Collection
alias for #count.
-
#size ⇒ Object
included
from Collection
alias for #count.
Selection collapse
-
#deselect_all ⇒ true, false
Tries to deselect all children.
-
#select_all ⇒ true, false
Tries to select all children.
-
#selectable? ⇒ true, false
Checks if the accessible the children belong to implements the selection interface.
-
#selected ⇒ Selected, []
Its selected subset.
Filter collapse
-
#where(*args) ⇒ Descendants
The children collection as filtered descendants collection.
Options collapse
-
#limit_to(limit) ⇒ Descendants
The children collection as limited descendants collection.
-
#recursive(recursive = true) ⇒ Descendants, self
Self if
recursiveis set tofalse. -
#sort_by(order) ⇒ Descendants
The children collection as sorted descendants collection.
Representation collapse
-
#inspect ⇒ String
included
from SelectableCollection
Instance as inspectable string.
Instance Method Details
#[](idx) ⇒ Object Originally defined in module Collection
alias for #at
#at(idx) ⇒ Accessible
Returns its child at index idx.
21 22 23 24 25 |
# File 'lib/atspi/accessible/children.rb', line 21 def at(idx) super do |mapped_idx| Accessible.new(@native.child_at_index(mapped_idx)) end end |
#count ⇒ Integer
Returns its number of children.
30 31 32 |
# File 'lib/atspi/accessible/children.rb', line 30 def count @native.child_count end |
#deselect_all ⇒ true, false
Tries to deselect all children
70 71 72 |
# File 'lib/atspi/accessible/children.rb', line 70 def deselect_all selectable? and @native.clear_selection end |
#each ⇒ Object Originally defined in module Collection
prerequisite for Enumerable
#inspect ⇒ String Originally defined in module SelectableCollection
Returns instance as inspectable string.
#last(n = 1) ⇒ Object+ Originally defined in module Collection
Returns item(s) from the end.
#length ⇒ Object Originally defined in module Collection
alias for #count
#limit_to(limit) ⇒ Descendants
Returns the children collection as limited descendants collection.
100 101 102 |
# File 'lib/atspi/accessible/children.rb', line 100 def limit_to(limit) Accessible::Descendants.new(@native).recursive(false).limit_to(limit) end |
#recursive(recursive = true) ⇒ Descendants, self
Returns self if recursive is set to false. A collection of all descendants if recursive is set to true.
108 109 110 111 112 113 114 |
# File 'lib/atspi/accessible/children.rb', line 108 def recursive(recursive = true) if recursive Accessible::Descendants.new(@native) else self end end |
#select_all ⇒ true, false
Tries to select all children
61 62 63 |
# File 'lib/atspi/accessible/children.rb', line 61 def select_all selectable? and @native.select_all end |
#selectable? ⇒ true, false
Checks if the accessible the children belong to implements the selection interface.
42 43 44 |
# File 'lib/atspi/accessible/children.rb', line 42 def selectable? not @native.selection_iface.nil? end |
#selected ⇒ Selected, []
Returns its selected subset. It will be an empty array if children are not selectable.
48 49 50 51 52 53 54 |
# File 'lib/atspi/accessible/children.rb', line 48 def selected if selectable? Selected.new(@native) else [] end end |
#size ⇒ Object Originally defined in module Collection
alias for #count
#sort_by(order) ⇒ Descendants
Returns the children collection as sorted descendants collection.
92 93 94 |
# File 'lib/atspi/accessible/children.rb', line 92 def sort_by(order) Accessible::Descendants.new(@native).recursive(false).sort_by(order) end |
#where(state: ) ⇒ Descendants #where(attributes: ) ⇒ Descendants #where(role: ) ⇒ Descendants #where(interface: ) ⇒ Descendants #where(name: ) ⇒ Descendants #where(filters) ⇒ Descendants
Filtering sometimes felt rocky on libatspi’s side during testing. See the notes in the following sections for details.
Returns the children collection as filtered descendants collection.
81 82 83 |
# File 'lib/atspi/accessible/children.rb', line 81 def where(*args) Accessible::Descendants.new(@native).recursive(false).where(*args) end |