Class: Gtk::TextView

Inherits:
Object
  • Object
show all
Extended by:
GLib::Deprecatable
Defined in:
lib/gtk4/text-view.rb,
lib/gtk4/deprecated.rb

Instance Method Summary collapse

Instance Method Details

#get_iter_at(options) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gtk4/text-view.rb', line 19

def get_iter_at(options)
  location = options[:location]
  position = options[:position]

  if location
    get_iter_at_location(*location)
  elsif position
    get_iter_at_position(*position)
  else
    message = "must specify :location or :position: #{options.inspect}"
    raise ArgumentError, message
  end
end

#get_iter_at_location(x, y) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/gtk4/text-view.rb', line 34

def get_iter_at_location(x, y)
  result = get_iter_at_location_raw(x, y)
  if result.is_a?(Gtk::TextIter) # For GTK+ < 3.20
    iter = result
    iter
  else
    found, iter = result
    if found
      iter
    else
      nil
    end
  end
end

#get_iter_at_location_rawObject



33
# File 'lib/gtk4/text-view.rb', line 33

alias_method :get_iter_at_location_raw, :get_iter_at_location

#get_iter_at_position(x, y) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/gtk4/text-view.rb', line 50

def get_iter_at_position(x, y)
  result = get_iter_at_position_raw(x, y)
  if result.size == 2 # For GTK+ < 3.20
    result
  else
    found, iter, trailing = result
    if found
      [iter, trailing]
    else
      nil
    end
  end
end

#get_iter_at_position_rawObject



49
# File 'lib/gtk4/text-view.rb', line 49

alias_method :get_iter_at_position_raw, :get_iter_at_position