# File tk/lib/tk/canvas.rb, line 730 def self.create(canvas, *args) unless self::CItemTypeName fail RuntimeError, "#{self} is an abstract class" end args, fontkeys, methodkeys = _parse_create_args(args) idnum = tk_call_without_enc(canvas.path, 'create', self::CItemTypeName, *args) canvas.itemconfigure(idnum, fontkeys) unless fontkeys.empty? canvas.itemconfigure(idnum, methodkeys) unless methodkeys.empty? idnum.to_i # 'canvas item id' is an integer number end
# File tk/lib/tk/canvas.rb, line 662 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
# File tk/lib/tk/canvas.rb, line 743 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
# File tk/lib/tk/canvas.rb, line 773 def delete @c.delete @id CItemID_TBL.mutex.synchronize{ CItemID_TBL[@path].delete(@id) if CItemID_TBL[@path] } self end