class Tk::Tile::Treeview::Item
Constants
- ItemID_TBL
Public Class Methods
assign(tree, id)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 708 def self.assign(tree, id) tpath = tree.path obj = nil Tk::Tile::Treeview::Item::ItemID_TBL.mutex.synchronize{ if Tk::Tile::Treeview::Item::ItemID_TBL[tpath] && Tk::Tile::Treeview::Item::ItemID_TBL[tpath][id] return Tk::Tile::Treeview::Item::ItemID_TBL[tpath][id] end obj = self.allocate obj.instance_eval{ @parent = @t = tree @tpath = tpath @path = @id = id } Tk::Tile::Treeview::Item::ItemID_TBL[tpath] ||= {} Tk::Tile::Treeview::Item::ItemID_TBL[tpath][id] = obj } obj end
id2obj(tree, id)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 696 def self.id2obj(tree, id) tpath = tree.path Tk::Tile::Treeview::Item::ItemID_TBL.mutex.synchronize{ if Tk::Tile::Treeview::Item::ItemID_TBL[tpath] (Tk::Tile::Treeview::Item::ItemID_TBL[tpath][id])? Tk::Tile::Treeview::Item::ItemID_TBL[tpath][id]: id else id end } end
new(tree, parent_item = '', idx = 'end', keys = {})
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 741 def initialize(tree, parent_item = '', idx = 'end', keys = {}) if parent_item.kind_of?(Hash) keys = parent_item idx = 'end' parent_item = '' elsif idx.kind_of?(Hash) keys = idx idx = 'end' end @parent = @t = tree @tpath = tree.path @path = @id = _insert_item(@t, parent_item, idx, keys) Tk::Tile::Treeview::Item::ItemID_TBL.mutex.synchronize{ ItemID_TBL[@tpath] = {} unless ItemID_TBL[@tpath] ItemID_TBL[@tpath][@id] = self } end
Public Instance Methods
bbox(column=None)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 803 def bbox(column=None) @t.bbox(@id, column) end
cget(option)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 766 def cget(option) @t.itemcget(@id, option) end
cget_strict(option)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 769 def cget_strict(option) @t.itemcget_strict(@id, option) end
cget_tkstring(option)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 763 def cget_tkstring(option) @t.itemcget_tkstring(@id, option) end
children()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 807 def children @t.children(@id) end
close()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 793 def close configure('open', false) self end
configinfo(key=nil)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 778 def configinfo(key=nil) @t.itemconfiginfo(@id, key) end
configure(key, value=None)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 773 def configure(key, value=None) @t.itemconfigure(@id, key, value) self end
current_configinfo(key=nil)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 782 def current_configinfo(key=nil) @t.current_itemconfiginfo(@id, key) end
delete()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 815 def delete @t.delete(@id) self end
detach()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 820 def detach @t.detach(@id) self end
exist?()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 825 def exist? @t.exist?(@id) end
focus()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 829 def focus @t.focus_item(@id) end
get(col)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 888 def get(col) @t.get(@id, col) end
get_directory()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 883 def get_directory @t.get_directory(@id) end
Also aliased as: get_dictionary
id()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 759 def id @id end
index()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 833 def index @t.index(@id) end
insert(idx='end', keys={})
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 837 def insert(idx='end', keys={}) @t.insert(@id, idx, keys) end
move(parent, idx)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 841 def move(parent, idx) @t.move(@id, parent, idx) self end
next_item()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 846 def next_item @t.next_item(@id) end
open()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 789 def open configure('open', true) self end
open?()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 786 def open? cget('open') end
parent_item()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 850 def parent_item @t.parent_item(@id) end
prev_item()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 854 def prev_item @t.prev_item(@id) end
see()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 858 def see @t.see(@id) self end
selection_add()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 863 def selection_add @t.selection_add(@id) self end
selection_remove()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 868 def selection_remove @t.selection_remove(@id) self end
selection_set()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 873 def selection_set @t.selection_set(@id) self end
selection_toggle()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 878 def selection_toggle @t.selection_toggle(@id) self end
set(col, value)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 892 def set(col, value) @t.set(@id, col, value) end
set_children(*items)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 810 def set_children(*items) @t.set_children(@id, *items) self end
tag_has?(tag)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 798 def tag_has?(tag) @t.tag_has?(tag, @id) end
Also aliased as: has_tag?
Private Instance Methods
_insert_item(tree, parent_item, idx, keys={})
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 729 def _insert_item(tree, parent_item, idx, keys={}) keys = _symbolkey2str(keys) id = keys.delete('id') if id num_or_str(tk_call(tree, 'insert', parent_item, idx, '-id', id, *hash_kv(keys))) else num_or_str(tk_call(tree, 'insert', parent_item, idx, *hash_kv(keys))) end end