def initialize(tree, pos, parent, keys)
@parent = @tree = tree
@tpath = @parent.path
if (id = keys['node'])
@path = @id = id
tk_call(@tpath, 'move', @id, pos, tagid(parent)) if parent
else
name = TreeNode_ID.join(TkCore::INTERP._ip_id_).freeze
TreeNode_ID[1].succ!
at = keys.delete['at']
if parent
if parent.kind_of?(Tk::BLT::Treeview::Node) ||
parent.kind_of?(Tk::BLT::Treeview::Tag)
path = [get_full(parent.id)[0], name]
at = nil
else
path = [parent.to_s, name]
end
else
path = name
end
if at
@id = tk_call(@tpath, 'insert', '-at', tagid(at), pos, path, keys)
else
@id = tk_call(@tpath, 'insert', pos, path, keys)
end
@path = @id
end
TreeNodeID_TBL[@tpath] = {} unless TreeNodeID_TBL[@tpath]
TreeNodeID_TBL[@tpath][@id] = self
end