Class: Gtk::TreeViewColumn

Inherits:
Widget show all
Defined in:
lib/gtk/tree_view_column.rb

Instance Attribute Summary

Attributes inherited from GObject

#native, #type

Instance Method Summary collapse

Methods inherited from Widget

#get_style_context

Methods inherited from GObject

#method_missing, #signal_connect, type_register, #unref

Constructor Details

#initialize(title = nil, renderer = nil, options = {}) ⇒ TreeViewColumn

Returns a new instance of TreeViewColumn.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/gtk/tree_view_column.rb', line 12

def initialize(title=nil,renderer=nil,options={})
  if title.is_a?(FFI::Pointer)
    @native = title
  else
    attributes = options.map{ |key,value| [:string,key.to_s,:int,value] }.flatten
    has_title_and_options = title && options.size > 0

    @native = if has_title_and_options
      raise "renderer misses native" unless renderer.native
      Lib.gtk_tree_view_column_new_with_attributes(title,renderer.native,*attributes,:string,nil)
    else
      Lib.gtk_tree_view_column_new()
    end

    unless has_title_and_options
      set_title(title) if title
      if options.size > 0
        Lib.gtk_tree_view_column_set_attributes(native,renderer.native,*attributes,:string,nil)
      end
    end
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Gtk::GObject