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 1179
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 1215
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 1230
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 1202
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 1262
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 1272
def forget
  tk_call(@tpath, 'tag', 'forget', @id)
  self
end
            
id() click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1258
def id
  @id
end
            
mutex() click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1171
def mutex; @mutex; end
            
nodes() click to toggle source
 
               # File tk/lib/tkextlib/blt/treeview.rb, line 1277
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 1267
def remove(*ids)
  tk_call(@tpath, 'tag', 'delete', @id, *(ids{|id| tagid(id)}))
  self
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.