Module: ATSPI::Accessible::Text::Editable
- Included in:
- ATSPI::Accessible::Text
- Defined in:
- lib/atspi/accessible/text/editable.rb
Overview
Wraps libatspi’s editable_text interface.
Attributes & States collapse
-
#editable? ⇒ true, false
Checks if it is editable.
Actions collapse
-
#copy(from: 0, to: length) ⇒ true, false
Copies its content in the given range into the clipboard.
-
#cut(from: 0, to: length) ⇒ true, false
Cuts its content in the given range and puts it into the clipboard.
-
#delete(from: 0, to: length) ⇒ true, false
Deletes its content in the given range.
-
#insert(text, at: caret) ⇒ true, false
Inserts a string at the given offset.
-
#paste(at: caret) ⇒ true, false
Pastes the string in the clipboard at the given offset.
-
#set_to(text) ⇒ true, false
Replaces its content with the given one.
Instance Method Details
#copy(from: 0, to: length) ⇒ true, false
Copies its content in the given range into the clipboard. Will succeed only if it’s editable.
59 60 61 |
# File 'lib/atspi/accessible/text/editable.rb', line 59 def copy(from: 0, to: length) editable? and @native.copy_text(from.to_i, to.to_i) end |
#cut(from: 0, to: length) ⇒ true, false
Cuts its content in the given range and puts it into the clipboard. Will succeed only if it’s editable.
72 73 74 |
# File 'lib/atspi/accessible/text/editable.rb', line 72 def cut(from: 0, to: length) editable? and @native.cut_text(from.to_i, to.to_i) end |
#delete(from: 0, to: length) ⇒ true, false
Deletes its content in the given range. Will succeed only if it’s editable.
85 86 87 |
# File 'lib/atspi/accessible/text/editable.rb', line 85 def delete(from: 0, to: length) editable? and @native.delete_text(from.to_i, to.to_i) end |
#editable? ⇒ true, false
Checks if it is editable.
10 11 12 |
# File 'lib/atspi/accessible/text/editable.rb', line 10 def editable? not @native.editable_text_iface.nil? end |
#insert(text, at: caret) ⇒ true, false
Inserts a string at the given offset. Will succeed only if it’s editable.
34 35 36 |
# File 'lib/atspi/accessible/text/editable.rb', line 34 def insert(text, at: caret) editable? and @native.insert_text(at.to_i, text.to_s, text.to_s.length) end |
#paste(at: caret) ⇒ true, false
Pastes the string in the clipboard at the given offset. Will succeed only if it’s editable.
46 47 48 |
# File 'lib/atspi/accessible/text/editable.rb', line 46 def paste(at: caret) editable? and @native.paste_text(at.to_i) end |
#set_to(text) ⇒ true, false
Replaces its content with the given one. Will succeed only if it’s editable.
22 23 24 |
# File 'lib/atspi/accessible/text/editable.rb', line 22 def set_to(text) delete && insert(text.to_s) end |