class TkBindTag - tk-0.2.0 Documentation

# class TkBindTag

### Constants

ALL
BTagID_TBL

  BTagID_TBL = {}

Tk_BINDTAG_ID

### Public Class Methods

id2obj(id) click to toggle source

    # File lib/tk/bindtag.rb, line 22
    def TkBindTag.id2obj(id)
      BTagID_TBL.mutex.synchronize{
        (BTagID_TBL[id])? BTagID_TBL[id]: id
      }
    end

new(*args, &b) click to toggle source

    # File lib/tk/bindtag.rb, line 60
    def initialize(*args, &b)
      Tk_BINDTAG_ID.mutex.synchronize{
        # @id = Tk_BINDTAG_ID.join('')
        @id = Tk_BINDTAG_ID.join(TkCore::INTERP._ip_id_)
        Tk_BINDTAG_ID[1].succ!
      }
      BTagID_TBL.mutex.synchronize{
        BTagID_TBL[@id] = self
      }
      bind(*args, &b) if args != []
    end

new_by_name(name, *args, &b) click to toggle source

def ::new_by_name(name, *args, &b)

    BTagID_TBL.mutex.synchronize{
      return BTagID_TBL[name] if BTagID_TBL[name]
    }

    self.new.instance_eval{
      BTagID_TBL.mutex.synchronize{
        BTagID_TBL.delete @id
        @id = name
        BTagID_TBL[@id] = self
      }
      bind(*args, &b) if args != []
      self
    }

end

    # File lib/tk/bindtag.rb, line 45
    def TkBindTag.new_by_name(name, *args, &b)
      obj = nil
      BTagID_TBL.mutex.synchronize{
        if BTagID_TBL[name]
          obj = BTagID_TBL[name]
        else
          (obj = BTagID_TBL[name] = self.allocate).instance_eval{
            @id = name
          }
        end
      }
      bind(*args, &b) if obj && args != []
      obj
    end

### Public Instance Methods

inspect() click to toggle source

    # File lib/tk/bindtag.rb, line 82
    def inspect
      #Kernel.format "#<TkBindTag: %s>", @id
      '#<TkBindTag: ' + @id + '>'
    end

mutex() click to toggle source

    # File lib/tk/bindtag.rb, line 14
    def mutex; @mutex; end

name() click to toggle source

    # File lib/tk/bindtag.rb, line 74
    def name
      @id
    end

to_eval() click to toggle source

    # File lib/tk/bindtag.rb, line 78
    def to_eval
      @id
    end