In Files

  • tk/lib/tk/canvas.rb
  • tk/lib/tkextlib/iwidgets/scrolledcanvas.rb

Class/Module Index [+]

Quicksearch

TkcItem

Public Class Methods

create(canvas, *args) click to toggle source
 
               # File tk/lib/tk/canvas.rb, line 674
def self.create(canvas, *args)
  unless self::CItemTypeName
    fail RuntimeError, "#{self} is an abstract class"
  end
  args, fontkeys = _parse_create_args(args)
  idnum = tk_call_without_enc(canvas.path, 'create', 
                              self::CItemTypeName, *args)
  canvas.itemconfigure(idnum, fontkeys) unless fontkeys.empty?
  idnum.to_i  # 'canvas item id' is an integer number
end
            
id2obj(canvas, id) click to toggle source
 
               # File tk/lib/tk/canvas.rb, line 606
def TkcItem.id2obj(canvas, id)
  cpath = canvas.path
  CItemID_TBL.mutex.synchronize{
    if CItemID_TBL[cpath]
      CItemID_TBL[cpath][id]? CItemID_TBL[cpath][id]: id
    else
      id
    end
  }
end
            
new(parent, *args) click to toggle source
 
               # File tk/lib/tk/canvas.rb, line 686
def initialize(parent, *args)
  #unless parent.kind_of?(Tk::Canvas)
  #  fail ArgumentError, "expect Tk::Canvas for 1st argument"
  #end
  @parent = @c = parent
  @path = parent.path

  @id = create_self(*args) # an integer number as 'canvas item id'
  CItemID_TBL.mutex.synchronize{
    CItemID_TBL[@path] = {} unless CItemID_TBL[@path]
    CItemID_TBL[@path][@id] = self
  }
end
            
type2class(type) click to toggle source
 
               # File tk/lib/tk/canvas.rb, line 602
def TkcItem.type2class(type)
  CItemTypeToClass[type]
end
            

Public Instance Methods

delete() click to toggle source
 
               # File tk/lib/tk/canvas.rb, line 716
def delete
  @c.delete @id
  CItemID_TBL.mutex.synchronize{
    CItemID_TBL[@path].delete(@id) if CItemID_TBL[@path]
  }
  self
end
            
Also aliased as: remove, destroy
destroy() click to toggle source
Alias for: delete
exist?() click to toggle source
 
               # File tk/lib/tk/canvas.rb, line 708
def exist?
  if @c.find_withtag(@id)
    true
  else
    false
  end
end
            
id() click to toggle source
 
               # File tk/lib/tk/canvas.rb, line 704
def id
  @id
end
            
remove() click to toggle source
Alias for: delete

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

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus