| In: |
tk/lib/tk/canvastag.rb
|
| Parent: | TkObject |
| CTagID_TBL | = | TkCore::INTERP.create_table |
| Tk_CanvasTag_ID | = | ['ctag'.freeze, '00000'.taint].freeze |
# File tk/lib/tk/canvastag.rb, line 182 def TkcTag.id2obj(canvas, id) cpath = canvas.path return id unless CTagID_TBL[cpath] CTagID_TBL[cpath][id]? CTagID_TBL[cpath][id]: id end
# File tk/lib/tk/canvastag.rb, line 188 def initialize(parent, mode=nil, *args) unless parent.kind_of?(TkCanvas) fail ArguemntError, "expect TkCanvas for 1st argument" end @c = parent @cpath = parent.path @path = @id = Tk_CanvasTag_ID.join('') CTagID_TBL[@cpath] = {} unless CTagID_TBL[@cpath] CTagID_TBL[@cpath][@id] = self Tk_CanvasTag_ID[1].succ! if mode tk_call_without_enc(@c.path, "addtag", @id, mode, *args) end end
# File tk/lib/tk/canvastag.rb, line 206 def delete @c.delete @id CTagID_TBL[@cpath].delete(@id) if CTagID_TBL[@cpath] self end
# File tk/lib/tk/canvastag.rb, line 214 def set_to_above(target) @c.addtag_above(@id, target) self end
# File tk/lib/tk/canvastag.rb, line 226 def set_to_below(target) @c.addtag_below(@id, target) self end
# File tk/lib/tk/canvastag.rb, line 232 def set_to_closest(x, y, halo=None, start=None) @c.addtag_closest(@id, x, y, halo, start) self end
# File tk/lib/tk/canvastag.rb, line 238 def set_to_enclosed(x1, y1, x2, y2) @c.addtag_enclosed(@id, x1, y1, x2, y2) self end
# File tk/lib/tk/canvastag.rb, line 244 def set_to_overlapping(x1, y1, x2, y2) @c.addtag_overlapping(@id, x1, y1, x2, y2) self end