Class | Tk::BLT::Treeview::Tag |
In: |
tk/lib/tkextlib/blt/treeview.rb
|
Parent: | TkObject |
TreeTagID_TBL | = | TkCore::INTERP.create_table |
TreeTag_ID | = | ['blt_treeview_tag'.freeze, '00000'.taint].freeze |
# File tk/lib/tkextlib/blt/treeview.rb, line 1058 def self.id2obj(tree, id) tpath = tree.path return id unless TreeTagID_TBL[tpath] if TreeTagID_TBL[tpath][id] TreeTagID_TBL[tpath][id] else begin self.new(tree, nil, nil, 'name'=>Integer(id)) rescue id end end end
# File tk/lib/tkextlib/blt/treeview.rb, line 1087 def initialize(tree, name, ids) @parent = @tree = tree @tpath = @parent.path if name @path = @id = name else @path = @id = TreeTag_ID.join(TkCore::INTERP._ip_id_).freeze TreeTag_ID[1].succ! end TreeTagID_TBL[@tpath] = {} unless TreeTagID_TBL[@tpath] TreeTagID_TBL[@tpath][@id] = self unless ids.empty? tk_call(@tpath, 'tag', 'add', @id, *(ids.collect{|id| tagid(id)})) end end
# File tk/lib/tkextlib/blt/treeview.rb, line 1079 def self.new(tree, *ids) if tree.kind_of?(Array) super(tree[0], tree[1], ids) else super(tree, nil, ids) end end
# File tk/lib/tkextlib/blt/treeview.rb, line 1072 def self.new_by_name(tree, name, *ids) if (obj = TreeTagID_TBL[tree.path][name]) return obj end new([tree, name], ids) end
# File tk/lib/tkextlib/blt/treeview.rb, line 1120 def add(*ids) tk_call(@tpath, 'tag', 'add', @id, *(ids{|id| tagid(id)})) self end
# File tk/lib/tkextlib/blt/treeview.rb, line 1130 def forget tk_call(@tpath, 'tag', 'forget', @id) self end
# File tk/lib/tkextlib/blt/treeview.rb, line 1135 def nodes simplelist(tk_call(@tpath, 'tag', 'nodes', @id)).collect{|id| Tk::BLT::Treeview::Node.id2obj(@tree, id) } end