Method: TkTextTag#initialize
- Defined in:
- lib/tk/texttag.rb
#initialize(parent, *args) ⇒ TkTextTag
Returns a new instance of TkTextTag.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/tk/texttag.rb', line 36 def initialize(parent, *args) #unless parent.kind_of?(TkText) # fail ArgumentError, "expect TkText for 1st argument" #end @parent = @t = parent @tpath = parent.path Tk_TextTag_ID.mutex.synchronize{ # @path = @id = Tk_TextTag_ID.join('') @path = @id = Tk_TextTag_ID.join(TkCore::INTERP._ip_id_).freeze Tk_TextTag_ID[1].succ! } TTagID_TBL.mutex.synchronize{ TTagID_TBL[@id] = self TTagID_TBL[@tpath] = {} unless TTagID_TBL[@tpath] TTagID_TBL[@tpath][@id] = self } #tk_call @t.path, "tag", "configure", @id, *hash_kv(keys) 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 |