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

### Methods

delete id id2obj info new new

### Constants

NotifyID_TBL | = | TkCore::INTERP.create_table

### Public Class methods

id2obj(tree, id)

[Source]

    # File tk/lib/tkextlib/blt/tree.rb, line 317
          def self.id2obj(tree, id)
            tpath = tree.path
            return id unless NotifyID_TBL[tpath]
            if NotifyID_TBL[tpath][id]
              NotifyID_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 331
          def self.new(tree, *args, &b)
            if tree.kind_of?(Array)
              # not create
              if obj = NotifyID_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, *args, &b)

[Source]

    # File tk/lib/tkextlib/blt/tree.rb, line 344
          def initialize(create, tree, *args, &b)
            @parent = @tree = tree
            @tpath = @parent.path

            unless create
              @path = @id = args[0]
              return
            end

            # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
            if TkComm._callback_entry?(args[0])
              cmd = args.shift
            # elsif args[-1].kind_of?(Proc) || args[-1].kind_of?(Method)
            elsif TkComm._callback_entry?(args[-1])
              cmd = args.pop
            elsif b
              cmd = Proc.new(&b)
            else
              fail ArgumentError, "lack of 'command' argument"
            end

            args = args.collect{|arg| '-' << arg.to_s}

            args << proc{|id, type|
              cmd.call(Tk::BLT::Tree::Node.id2obj(@tree, id),
                       ((type[0] == ?-)? type[1..-1]: type))
            }

            @path = @id = tk_call(@tpath, 'notify', 'create', *args)
          end

### Public Instance methods

delete()

[Source]

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

id()

[Source]

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

info()

[Source]

    # File tk/lib/tkextlib/blt/tree.rb, line 385
          def info()
            lst = simplelist(tk_call(@tpath, 'notify', 'info', id))
            lst[0] = Tk::BLT::Tree::Notify.id2obj(@tree, lst[0])
            lst[1] = simplelist(lst[1]).collect{|flag| flag[1..-1]}
            lst[2] = tk_tcl2ruby(lst[2])
            lst
          end

[Validate]