class TktNamedMark - tk-0.1.2 Documentation

# class TktNamedMark

### Public Class Methods

new(parent, name, index=nil) click to toggle source

    # File lib/tk/textmark.rb, line 144
    def self.new(parent, name, index=nil)
      TMarkID_TBL.mutex.synchronize{
        if TMarkID_TBL[parent.path] && TMarkID_TBL[parent.path][name]
          obj = TMarkID_TBL[parent.path][name]
        else
          # super(parent, name, *args)
          (obj = self.allocate).instance_eval{
            @parent = @t = parent
            @tpath = parent.path
            @path = @id = name
            TMarkID_TBL[@id] = self
            TMarkID_TBL[@tpath] = {} unless TMarkID_TBL[@tpath]
            TMarkID_TBL[@tpath][@id] = self unless TMarkID_TBL[@tpath][@id]
            @t._addtag @id, self
          }
          obj
        end

        if obj && index
          tk_call_without_enc(parent.path, 'mark', 'set', name,
                              _get_eval_enc_str(index))
        end
        obj
      }
    end

new(parent, name, index=nil) click to toggle source

    # File lib/tk/textmark.rb, line 170
    def initialize(parent, name, index=nil)
      # dummy:: not called by 'new' method

      #unless parent.kind_of?(Tk::Text)
      #  fail ArgumentError, "expect Tk::Text for 1st argument"
      #end
      @parent = @t = parent
      @tpath = parent.path
      @path = @id = name
      tk_call_without_enc(@t.path, 'mark', 'set', @id,
                          _get_eval_enc_str(index)) if index
      @t._addtag @id, self
    end