In Files

  • tk/lib/tkextlib/blt/treeview.rb

Class/Module Index [+]

Quicksearch

Tk::BLT::Treeview::Tag

Public Class Methods

id2obj(tree, id) click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1058
def self.id2obj(tree, id)
  tpath = tree.path
  return id unless TreeTagID_TBL[tpath]
  if TreeTagID_TBL[tpath][id]
    TreeTagID_TBL[tpath][id]
  else
    begin
      self.new(tree, nil, nil, 'name'=>Integer(id))
    rescue
      id
    end
  end
end
            
new(tree, *ids) click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1079
def self.new(tree, *ids)
  if tree.kind_of?(Array)
    super(tree[0], tree[1], ids)
  else
    super(tree, nil, ids)
  end
end
            
new(tree, name, ids) click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1087
def initialize(tree, name, ids)
  @parent = @tree = tree
  @tpath = @parent.path

  if name
    @path = @id = name
  else
    @path = @id = TreeTag_ID.join(TkCore::INTERP._ip_id_).freeze
    TreeTag_ID[1].succ!
  end

  TreeTagID_TBL[@tpath] = {} unless TreeTagID_TBL[@tpath]
  TreeTagID_TBL[@tpath][@id] = self

  unless ids.empty?
    tk_call(@tpath, 'tag', 'add', @id, *(ids.collect{|id| tagid(id)}))
  end
end
            
new_by_name(tree, name, *ids) click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1072
def self.new_by_name(tree, name, *ids)
  if (obj = TreeTagID_TBL[tree.path][name])
    return obj
  end
  new([tree, name], ids)
end
            

Public Instance Methods

add(*ids) click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1120
def add(*ids)
  tk_call(@tpath, 'tag', 'add', @id, *(ids{|id| tagid(id)}))
  self
end
            
forget() click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1130
def forget
  tk_call(@tpath, 'tag', 'forget', @id)
  self
end
            
id() click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1116
def id
  @id
end
            
nodes() click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1135
def nodes
  simplelist(tk_call(@tpath, 'tag', 'nodes', @id)).collect{|id|
    Tk::BLT::Treeview::Node.id2obj(@tree, id)
  }
end
            
remove(*ids) click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1125
def remove(*ids)
  tk_call(@tpath, 'tag', 'delete', @id, *(ids{|id| tagid(id)}))
  self
end