Class: Gtk::TreeView

Inherits:
Widget show all
Defined in:
lib/gtk/tree_view.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(model = nil) ⇒ TreeView

Returns a new instance of TreeView.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gtk/tree_view.rb', line 10

def initialize(model=nil)
  @native = if model
    if model.is_a?(FFI::Pointer)
      model
    else
      Lib.gtk_tree_view_new_with_model(model.native)
    end
  else
    Lib.gtk_tree_view_new()
  end
end

Dynamic Method Handling

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

Instance Method Details

#get_cursorObject



24
25
26
27
28
29
30
31
# File 'lib/gtk/tree_view.rb', line 24

def get_cursor
  path = FFI::MemoryPointer.new :pointer
  column = FFI::MemoryPointer.new :pointer
  Lib.gtk_tree_view_get_cursor(native,path,column)
  path = path.get_pointer(0)
  column = column.get_pointer(0)
  [TreePath.new(path),TreeViewColumn.new(column)]
end

#get_selectionObject



21
22
23
# File 'lib/gtk/tree_view.rb', line 21

def get_selection
  TreeSelection.new(Lib.gtk_tree_view_get_selection(native))
end