Class: VR::TreeView

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

Overview

All the methods in VR::ViewCommon work on VR::TreeViews and VR::ListViews.

Direct Known Subclasses

FileTreeView

Instance Attribute Summary

Attributes included from ViewCommon

#column_keys, #vr_cols, #vr_column, #vr_id, #vr_renderer

Instance Method Summary collapse

Methods included from ViewCommon

#add_column, #add_renderer_to_col, #col_attr, #column, #delete_selected, #each_cell_method, #each_renderer, #each_row, #flatten_hash, #get_iter, #id, #initialize, #method_missing, #ren_attr, #renderer, #selected_rows, #turn_on_comboboxes, #vr_row

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

def initialize(cols)

super()
args = *flatten_hash(cols).values

alert args.to_s

     self.model = Gtk::TreeStore.new(*args)  # *flatten_hash(cols).values)
     load_columns(cols)
   end

Adds row to the model.  This will return a "row" type iter that responds
to column IDs (symbols).  You need to provide a parent row (iter).
See GtkTreeView#append for more.

The iter is a GtkTreeIter object for the parent or nil for the root of the tree.  The hash argument is a Hash of values to add:

@view.add_row(iter, :name => "Chester", :email => "chester@chesterizer.com")


53
54
55
56
57
# File 'lib/treeview/TreeView.rb', line 53

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