Method: Tk::BLT::Tree::Tag#initialize

Defined in:
lib/tkextlib/blt/tree.rb

#initialize(tree, tag_str = nil) ⇒ Tag

Returns a new instance of Tag.



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/tkextlib/blt/tree.rb', line 309

def initialize(tree, tag_str = nil)
  @parent = @tree = tree
  @tpath = @parent.path

  if tag_str
    @path = @id = tag_str.dup.freeze
  else
    TreeTag_ID.mutex.synchronize{
      @path = @id = TreeTag_ID.join(TkCore::INTERP._ip_id_)
      TreeTag_ID[1].succ!
    }
  end
  TreeTagID_TBL.mutex.synchronize{
    TreeTagID_TBL[@tpath] = {} unless TreeTagID_TBL[@tpath]
    TreeTagID_TBL[@tpath][@id] = self
  }
end