Class TkTextNamedTag
In: tk/lib/tk/texttag.rb
Parent: TkTextTag

Methods

new   new  

Public Class methods

[Source]

# File tk/lib/tk/texttag.rb, line 230
  def self.new(parent, name, *args)
    if TTagID_TBL[parent.path] && TTagID_TBL[parent.path][name]
      tagobj = TTagID_TBL[parent.path][name]
      if args != []
        keys = args.pop
        if keys.kind_of?(Hash)
          tagobj.add(*args) if args != []
          tagobj.configure(keys)
        else
          args.push keys
          tagobj.add(*args)
        end
      end
      return tagobj
    else
      super(parent, name, *args)
    end
  end

[Source]

# File tk/lib/tk/texttag.rb, line 249
  def initialize(parent, name, *args)
    #unless parent.kind_of?(TkText)
    #  fail ArgumentError, "expect TkText for 1st argument"
    #end
    @parent = @t = parent
    @tpath = parent.path
    @path = @id = name
    TTagID_TBL[@tpath] = {} unless TTagID_TBL[@tpath]
    TTagID_TBL[@tpath][@id] = self unless TTagID_TBL[@tpath][@id]
    #if mode
    #  tk_call @t.path, "addtag", @id, *args
    #end
    if args != []
      keys = args.pop
      if keys.kind_of?(Hash)
        add(*args) if args != []
        configure(keys)
      else
        args.push keys
        add(*args)
      end
    end
    @t._addtag id, self
  end

[Validate]