Class: VR::TreeView

Inherits:
Gtk::TreeView
  • Object
show all
Includes:
ViewCommon
Defined in:
lib/treeview/TreeView.rb

Overview

TreeView is almost identical to VR::ListView. The only difference

is how rows are added, and that they use a different model class.
See VR::ListView for in-depth docs.  Also, see Gtk::TreeView for more.

Also, most of the useful methods for VR::TreeView are found in VR::ViewCommon.
All the methods in VR::ViewCommon work on VR::TreeViews and VR::ListViews.

Direct Known Subclasses

FileTreeView

Instance Attribute Summary

Attributes included from ViewCommon

#vr_renderer

Instance Method Summary collapse

Methods included from ViewCommon

#col_attr, #column, #delete_selected, #each_renderer, #each_row, #flatten_hash, #get_iter, #id, #load_columns, #method_missing, #ren_attr, #renderer, #selected_rows, #turn_on_comboboxes, #vr_row

Constructor Details

#initialize(cols) ⇒ TreeView

See VR::ListView constructor. (exactly the same)



17
18
19
20
21
# File 'lib/treeview/TreeView.rb', line 17

def initialize(cols)
  super()
  self.model = Gtk::TreeStore.new(*flatten_hash(cols).values)
  load_columns(cols)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class VR::ViewCommon

Instance Method Details

#add_row(parent, hash = {}) ⇒ Object



35
36
37
38
39
# File 'lib/treeview/TreeView.rb', line 35

def add_row(parent, hash = {})
  row = vr_row(model.append(parent))
  hash.each_pair { |key, val| row[key] = val }
  return row
end