Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more
# File tk/lib/tkextlib/bwidget/tree.rb, line 277 def self.id2obj(tree, id) tpath = tree.path TreeNode_TBL.mutex.synchronize{ if TreeNode_TBL[tpath] TreeNode_TBL[tpath][id]? TreeNode_TBL[tpath][id]: id else id end } end
# File tk/lib/tkextlib/bwidget/tree.rb, line 288 def initialize(tree, *args) if tree.kind_of?(Tk::BWidget::Tree) @tree = tree parent = args.shift if parent.kind_of?(Tk::BWidget::Tree::Node) if parent.tree.path != @tree.path fail RuntimeError, 'tree of parent node is not match' end end elsif tree.kind_of?(Tk::BWidget::Tree::Node) @tree = tree.tree parent = tree.parent else fail RuntimeError, "expect Tk::BWidget::Tree or Tk::BWidget::Tree::Node for 1st argument" end if args[-1].kind_of?(Hash) keys = _symbolkey2str(args.pop) else keys = {} end index = keys.delete('index') unless args.empty? index = args.shift end index = 'end' unless index unless args.empty? fail RuntimeError, 'too much arguments' end @tpath = @tree.path if keys.key?('nodename') @path = @id = keys.delete('nodename') else TreeNode_ID.mutex.synchronize{ @path = @id = TreeNode_ID.join(TkCore::INTERP._ip_id_) TreeNode_ID[1].succ! } end TreeNode_TBL.mutex.synchronize{ TreeNode_TBL[@id] = self TreeNode_TBL[@tpath] = {} unless TreeNode_TBL[@tpath] TreeNode_TBL[@tpath][@id] = self } @tree.insert(index, parent, @id, keys) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 349 def [](key) cget(key) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 353 def []=(key, val) configure(key, val) val end
# File tk/lib/tkextlib/bwidget/tree.rb, line 358 def cget(key) @tree.itemcget(@id, key) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 361 def cget_strict(key) @tree.itemcget_strict(@id, key) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 377 def close_tree(recurse=None) @tree.close_tree(@id, recurse) self end
# File tk/lib/tkextlib/bwidget/tree.rb, line 369 def configinfo(key=nil) @tree.itemconfiginfo(@id, key) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 365 def configure(key, val=None) @tree.itemconfigure(@id, key, val) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 373 def current_configinfo(key=nil) @tree.current_itemconfiginfo(@id, key) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 382 def delete @tree.delete(@id) self end
# File tk/lib/tkextlib/bwidget/tree.rb, line 387 def edit(*args) @tree.edit(@id, *args) self end
# File tk/lib/tkextlib/bwidget/tree.rb, line 392 def exist? @tree.exist?(@id) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 396 def index @tree.index(@id) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 400 def move(index, parent=nil) if parent @tree.move(parent, @id, index) else @tree.move(self.parent, @id, index) end end
# File tk/lib/tkextlib/bwidget/tree.rb, line 269 def mutex; @mutex; end
# File tk/lib/tkextlib/bwidget/tree.rb, line 413 def open? bool(@tree.itemcget(@id, 'open')) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 408 def open_tree(recurse=None) @tree.open_tree(@id, recurse) self end
# File tk/lib/tkextlib/bwidget/tree.rb, line 417 def parent @tree.parent(@id) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 421 def reorder(neworder) @tree.reorder(@id, neworder) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 425 def see @tree.see(@id) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 429 def selection_add @tree.selection_add(@id) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 433 def selection_remove @tree.selection_remove(@id) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 437 def selection_set @tree.selection_set(@id) end
# File tk/lib/tkextlib/bwidget/tree.rb, line 441 def selection_toggle @tree.selection_toggle(@id) end