Class | Tk::BLT::Tree::Trace
In: | tk/lib/tkextlib/blt/tree.rb
Parent: | TkObject

### Methods

delete id id2obj info new new

### Constants

TraceID_TBL | = | TkCore::INTERP.create_table

### Public Class methods

id2obj(tree, id)

[Source]

    # File tk/lib/tkextlib/blt/tree.rb, line 400
          def self.id2obj(tree, id)
            tpath = tree.path
            return id unless TraceID_TBL[tpath]
            if TraceID_TBL[tpath][id]
              TraceID_TBL[tpath][id]
            else
              begin
                self.new([tree, id])
              rescue
                id
              end
            end
          end

new(tree, *args, &b)

[Source]

    # File tk/lib/tkextlib/blt/tree.rb, line 414
          def self.new(tree, *args, &b)
            if tree.kind_of?(Array)
              # not create
              if obj = TraceID_TBL[tree[0].path][tree[1]]
                return obj
              else
                return super(false, tree[0], tree[1])
              end
            end

            super(true, tree, *args, &b)
          end

new(create, tree, node, key, opts, cmd=nil, &b)

[Source]

    # File tk/lib/tkextlib/blt/tree.rb, line 427
          def initialize(create, tree, node, key, opts, cmd=nil, &b)
            @parent = @tree = tree
            @tpath = @parent.path

            unless create
              @path = @id = node  # == traceID
              return
            end

            if !cmd
              if b
                cmd = Proc.new(&b)
              else
                fail ArgumentError, "lack of 'command' argument"
              end
            end

            @path = @id = tk_call(@tpath, 'trace', 'create', node, key, opts,
                                  proc{|t, id, k, ops|
                                    tobj = Tk::BLT::Tree.id2obj(t)
                                    if tobj.kind_of?(Tk::BLT::Tree)
                                      nobj = Tk::BLT::Tree::Node.id2obj(tobj, id)
                                    else
                                      nobj = id
                                    end
                                    cmd.call(tobj, nobj, k, ops)
                                  })
          end

### Public Instance methods

delete()

[Source]

    # File tk/lib/tkextlib/blt/tree.rb, line 460
          def delete()
            tk_call(@tpath, 'trace', 'delete', @id)
            TraceID_TBL[tpath].delete(@id)
            self
          end

id()

[Source]

    # File tk/lib/tkextlib/blt/tree.rb, line 456
          def id
            @id
          end

info()

[Source]

    # File tk/lib/tkextlib/blt/tree.rb, line 466
          def info()
            lst = simplelist(tk_call(@tpath, 'trace', 'info', id))
            lst[0] = Tk::BLT::Tree::Trace.id2obj(@tree, lst[0])
            lst[2] = simplelist(lst[2])
            lst[3] = tk_tcl2ruby(lst[3])
            lst
          end

[Validate]