Class: Gtk::TreeViewColumn

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

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ 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/gtk3/tree-view-column.rb', line 20

def initialize(*args)
  if args.size == 1 and args[0].is_a?(Hash)
    options = args[0].dup
    area = options.delete(:area)
    renderer = options.delete(:renderer)
    title = options.delete(:title)
    attributes = options.delete(:attributes)
    unless options.empty?
      names = options.keys.inspect
      available_names = [:area, :renderer, :title, :attributes].inspect
      message =
        "unknown option(s): #{names}: available options: #{available_names}"
      raise ArgumentError, message
    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/gtk3/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_rawObject


55
# File 'lib/gtk3/tree-view-column.rb', line 55

alias_method :add_attribute_raw, :add_attribute

#initialize_rawObject


19
# File 'lib/gtk3/tree-view-column.rb', line 19

alias_method :initialize_raw, :initialize