Module: Gtk::TreeModel
- Extended by:
- GLib::Deprecatable
- Defined in:
- lib/gtk4/deprecated.rb,
lib/gtk4/tree-model.rb
Instance Method Summary collapse
- #each ⇒ Object
- #each_raw ⇒ Object
- #get_column_type(index) ⇒ Object
- #get_column_type_raw ⇒ Object
- #get_iter(path) ⇒ Object
- #get_iter_raw ⇒ Object
- #get_value(iter, column) ⇒ Object
- #get_value_raw ⇒ Object
- #iter_children(iter) ⇒ Object
- #iter_children_raw ⇒ Object
- #iter_first ⇒ Object
- #iter_first_raw ⇒ Object
- #iter_nth_child(iter, n) ⇒ Object
- #iter_nth_child_raw ⇒ Object
- #iter_parent(iter) ⇒ Object
- #iter_parent_raw ⇒ Object
- #set_values(iter, values) ⇒ Object
Instance Method Details
#each ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/gtk4/tree-model.rb', line 111 def each return to_enum(__method__) unless block_given? exception = nil each_raw do |model, path, iter| stop = true # TODO: This doesn't return 'stop' to GTK when caller uses 'break'. begin iter.model = model yield(model, path, iter) stop = false rescue Exception => e exception = e end stop end raise exception if exception self end |
#each_raw ⇒ Object
110 |
# File 'lib/gtk4/tree-model.rb', line 110 alias_method :each_raw, :each |
#get_column_type(index) ⇒ Object
104 105 106 |
# File 'lib/gtk4/tree-model.rb', line 104 def get_column_type(index) (@column_types ||= {})[index] ||= get_column_type_raw(index) end |
#get_column_type_raw ⇒ Object
103 |
# File 'lib/gtk4/tree-model.rb', line 103 alias_method :get_column_type_raw, :get_column_type |
#get_iter(path) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/gtk4/tree-model.rb', line 20 def get_iter(path) if path.is_a?(String) got, iter = get_iter_from_string(path) else got, iter = get_iter_raw(path) end if got setup_iter(iter) iter else nil end end |
#get_iter_raw ⇒ Object
19 |
# File 'lib/gtk4/tree-model.rb', line 19 alias_method :get_iter_raw, :get_iter |
#get_value(iter, column) ⇒ Object
58 59 60 |
# File 'lib/gtk4/tree-model.rb', line 58 def get_value(iter, column) get_value_raw(iter, column).value end |
#get_value_raw ⇒ Object
57 |
# File 'lib/gtk4/tree-model.rb', line 57 alias_method :get_value_raw, :get_value |
#iter_children(iter) ⇒ Object
74 75 76 77 78 79 80 81 82 |
# File 'lib/gtk4/tree-model.rb', line 74 def iter_children(iter) got, iter = iter_children_raw(iter) if got setup_iter(iter) iter else nil end end |
#iter_children_raw ⇒ Object
73 |
# File 'lib/gtk4/tree-model.rb', line 73 alias_method :iter_children_raw, :iter_children |
#iter_first ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/gtk4/tree-model.rb', line 36 def iter_first got, iter = iter_first_raw if got setup_iter(iter) iter else nil end end |
#iter_first_raw ⇒ Object
35 |
# File 'lib/gtk4/tree-model.rb', line 35 alias_method :iter_first_raw, :iter_first |
#iter_nth_child(iter, n) ⇒ Object
63 64 65 66 67 68 69 70 71 |
# File 'lib/gtk4/tree-model.rb', line 63 def iter_nth_child(iter, n) got, iter = iter_nth_child_raw(iter, n) if got setup_iter(iter) iter else nil end end |
#iter_nth_child_raw ⇒ Object
62 |
# File 'lib/gtk4/tree-model.rb', line 62 alias_method :iter_nth_child_raw, :iter_nth_child |
#iter_parent(iter) ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/gtk4/tree-model.rb', line 47 def iter_parent(iter) got, iter = iter_parent_raw(iter) if got setup_iter(iter) iter else nil end end |
#iter_parent_raw ⇒ Object
46 |
# File 'lib/gtk4/tree-model.rb', line 46 alias_method :iter_parent_raw, :iter_parent |
#set_values(iter, values) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/gtk4/tree-model.rb', line 84 def set_values(iter, values) columns = [] _values = [] if values.is_a?(Hash) values.each do |column_id, value| type = get_column_type(column_id) columns << column_id _values << GLib::Value.new(type, value) end else values.each_with_index do |value, i| type = get_column_type(i) columns << i _values << GLib::Value.new(type, value) end end set(iter, columns, _values) end |