Class/Module Index [+]

Quicksearch

Tk::BLT::Tree::Notify

Constants

NotifyID_TBL

Public Class Methods

id2obj(tree, id) click to toggle source
 
               # File tk/lib/tkextlib/blt/tree.rb, line 374
def self.id2obj(tree, id)
  tpath = tree.path
  NotifyID_TBL.mutex.synchronize{
    if NotifyID_TBL[tpath]
      if NotifyID_TBL[tpath][id]
        NotifyID_TBL[tpath][id]
      else
        (obj = self.allocate).instance_eval{
          @parent = @tree = tree
          @tpath = @parent.path
          @path = @id = id
          NotifyID_TBL[@tpath] ||= {}
          NotifyID_TBL[@tpath][@id] = self
        }
        obj
      end
    else
      return id
    end
  }
end
            
new(tree, *args, &b) click to toggle source
 
               # File tk/lib/tkextlib/blt/tree.rb, line 396
def self.new(tree, *args, &b)
  NotifyID_TBL.mutex.synchronize{
    if tree.kind_of?(Array)
      # not create
      tpath = tree[0].path
      NotifyID_TBL[tpath] ||= {}
      unless (obj = NotifyID_TBL[tpath][tree[1]])
        (NotifyID_TBL[tpath][tree[1]] =
           obj = self.allocate).instance_eval{
          @parent = @tree = tree[0]
          @tpath = @parent.path
          @path = @id = tree[1]
        }
      end
      return obj
    end

    (obj = self.allocate).instance_eval{
      initialize(tree, *args, &b)
      NotifyID_TBL[@tpath] ||= {}
      NotifyID_TBL[@tpath][@id] = self
    }
    return obj
  }
end
            
new(tree, *args, &b) click to toggle source
 
               # File tk/lib/tkextlib/blt/tree.rb, line 422
def initialize(tree, *args, &b)
  @parent = @tree = tree
  @tpath = @parent.path

  # 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() click to toggle source
 
               # File tk/lib/tkextlib/blt/tree.rb, line 452
def delete()
  tk_call(@tpath, 'notify', 'delete', @id)
  NotifyID_TBL.mutex.synchronize{
    NotifyID_TBL[@tpath].delete(@id)
  }
  self
end
            
id() click to toggle source
 
               # File tk/lib/tkextlib/blt/tree.rb, line 448
def id
  @id
end
            
info() click to toggle source
 
               # File tk/lib/tkextlib/blt/tree.rb, line 460
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
            

Commenting is here to help enhance the documentation. For example, sample code, 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.

blog comments powered by Disqus