In Files

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

Class/Module Index [+]

Quicksearch

Tk::BLT::Treeview::Tag

Public Class Methods

id2obj(tree, name) click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1178
def self.id2obj(tree, name)
  tpath = tree.path
  TreeTagID_TBL.mutex.synchronize{
    if TreeTagID_TBL[tpath]
      if TreeTagID_TBL[tpath][name]
        TreeTagID_TBL[tpath][name]
      else
        #self.new(tree, name)
        (obj = self.allocate).instance_eval{
          @parent = @tree = tree
          @tpath = @parent.path
          @path = @id = name
          TreeTagID_TBL[@tpath] = {} unless TreeTagID_TBL[@tpath]
          TreeTagID_TBL[@tpath][@id] = self
        }
        obj
      end
    else
      id
    end
  }
end
            
new(tree, *ids) click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1214
def self.new(tree, *ids)
  TreeTagID_TBL.mutex.synchronize{
    (obj = self.allocate).instance_eval{
      if tree.kind_of?(Array)
        initialize(tree[0], tree[1], ids)
      else
        initialize(tree, nil, ids)
      end
      TreeTagID_TBL[@tpath] = {} unless TreeTagID_TBL[@tpath]
      TreeTagID_TBL[@tpath][@id] = self
    }
    obj
  }
end
            
new(tree, name, ids) click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1229
def initialize(tree, name, ids)
  @parent = @tree = tree
  @tpath = @parent.path

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

  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 1201
def self.new_by_name(tree, name, *ids)
  TreeTagID_TBL.mutex.synchronize{
    unless (obj = TreeTagID_TBL[tree.path][name])
      (obj = self.allocate).instance_eval{
        initialize(tree, name, ids)
        TreeTagID_TBL[@tpath] = {} unless TreeTagID_TBL[@tpath]
        TreeTagID_TBL[@tpath][@id] = self
      }
    end
    obj
  }
end
            

Public Instance Methods

add(*ids) click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1261
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 1271
def forget
  tk_call(@tpath, 'tag', 'forget', @id)
  self
end
            
id() click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1257
def id
  @id
end
            
mutex() click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1170
def mutex; @mutex; end
            
nodes() click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1276
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 1266
def remove(*ids)
  tk_call(@tpath, 'tag', 'delete', @id, *(ids{|id| tagid(id)}))
  self
end