class TkcNamedTag - tk-0.2.0 Documentation

# class TkcNamedTag

### Public Class Methods

new(parent, name, mode=nil, *args) click to toggle source

    # File lib/tk/canvastag.rb, line 337
    def self.new(parent, name, mode=nil, *args)
      obj = nil
      CTagID_TBL.mutex.synchronize{
        if CTagID_TBL[parent.path] && CTagID_TBL[parent.path][name]
          obj = CTagID_TBL[parent.path][name]
        else
          # super(parent, name, *args)
          (obj = self.allocate).instance_eval{
            @c = parent
            @cpath = parent.path
            @path = @id = name
            CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath]
            CTagID_TBL[@cpath][@id] = self
          }
        end
      }
      if obj && mode
        tk_call_without_enc(@c.path, "addtag", @id, mode, *args)
      end
      obj
    end

new(parent, name, mode=nil, *args) click to toggle source

    # File lib/tk/canvastag.rb, line 359
    def initialize(parent, name, mode=nil, *args)
      # dummy:: not called by 'new' method

      #unless parent.kind_of?(TkCanvas)
      #  fail ArgumentError, "expect TkCanvas for 1st argument"
      #end
      @c = parent
      @cpath = parent.path
      @path = @id = name

      if mode
        tk_call_without_enc(@c.path, "addtag", @id, mode, *args)
      end
    end