Class: Gtk::TreeViewColumn
- Inherits:
-
Object
- Object
- Gtk::TreeViewColumn
- Extended by:
- GLib::Deprecatable
- Defined in:
- lib/gtk4/deprecated.rb,
lib/gtk4/tree-view-column.rb
Instance Method Summary collapse
- #add_attribute(renderer, key, value) ⇒ Object
- #add_attribute_raw ⇒ Object
-
#initialize(*args) ⇒ TreeViewColumn
constructor
A new instance of TreeViewColumn.
- #initialize_raw ⇒ Object
- #set_cell_data_func(cell) ⇒ Object
- #set_cell_data_func_raw ⇒ Object
Constructor Details
#initialize(*args) ⇒ TreeViewColumn
Returns a new instance of TreeViewColumn.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/gtk4/tree-view-column.rb', line 20 def initialize(*args) if args.size == 1 and args[0].is_a?(Hash) = args[0].dup area = .delete(:area) renderer = .delete(:renderer) title = .delete(:title) attributes = .delete(:attributes) unless .empty? names = .keys.inspect available_names = [:area, :renderer, :title, :attributes].inspect = "unknown option(s): #{names}: available options: #{available_names}" raise ArgumentError, end else area = nil title, renderer, attributes = args end attributes ||= {} if area initialize_new_with_area(area) else initialize_raw end set_title(title) if title if renderer pack_start(renderer, true) attributes.each_entry do |key, value| add_attribute(renderer, key, value) end end end |
Instance Method Details
#add_attribute(renderer, key, value) ⇒ Object
56 57 58 59 |
# File 'lib/gtk4/tree-view-column.rb', line 56 def add_attribute(renderer, key, value) key = key.to_s if key.is_a?(Symbol) add_attribute_raw(renderer, key, value) end |
#add_attribute_raw ⇒ Object
55 |
# File 'lib/gtk4/tree-view-column.rb', line 55 alias_method :add_attribute_raw, :add_attribute |
#initialize_raw ⇒ Object
19 |
# File 'lib/gtk4/tree-view-column.rb', line 19 alias_method :initialize_raw, :initialize |
#set_cell_data_func(cell) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/gtk4/tree-view-column.rb', line 62 def set_cell_data_func(cell) set_cell_data_func_raw(cell) do |column, cell, model, iter| iter.model = model yield(column, cell, model, iter) end end |
#set_cell_data_func_raw ⇒ Object
61 |
# File 'lib/gtk4/tree-view-column.rb', line 61 alias_method :set_cell_data_func_raw, :set_cell_data_func |