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 709 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 697 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 742 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 804 def bbox(column=None) @t.bbox(@id, column) end
cget(option)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 767 def cget(option) @t.itemcget(@id, option) end
cget_strict(option)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 770 def cget_strict(option) @t.itemcget_strict(@id, option) end
cget_tkstring(option)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 764 def cget_tkstring(option) @t.itemcget_tkstring(@id, option) end
children()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 808 def children @t.children(@id) end
close()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 794 def close configure('open', false) self end
configinfo(key=nil)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 779 def configinfo(key=nil) @t.itemconfiginfo(@id, key) end
configure(key, value=None)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 774 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 783 def current_configinfo(key=nil) @t.current_itemconfiginfo(@id, key) end
delete()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 816 def delete @t.delete(@id) self end
detach()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 821 def detach @t.detach(@id) self end
exist?()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 826 def exist? @t.exist?(@id) end
focus()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 830 def focus @t.focus_item(@id) end
get(col)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 889 def get(col) @t.get(@id, col) end
get_directory()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 884 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 760 def id @id end
index()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 834 def index @t.index(@id) end
insert(idx='end', keys={})
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 838 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 842 def move(parent, idx) @t.move(@id, parent, idx) self end
next_item()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 847 def next_item @t.next_item(@id) end
open()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 790 def open configure('open', true) self end
open?()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 787 def open? cget('open') end
parent_item()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 851 def parent_item @t.parent_item(@id) end
prev_item()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 855 def prev_item @t.prev_item(@id) end
see()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 859 def see @t.see(@id) self end
selection_add()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 864 def selection_add @t.selection_add(@id) self end
selection_remove()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 869 def selection_remove @t.selection_remove(@id) self end
selection_set()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 874 def selection_set @t.selection_set(@id) self end
selection_toggle()
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 879 def selection_toggle @t.selection_toggle(@id) self end
set(col, value)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 893 def set(col, value) @t.set(@id, col, value) end
set_children(*items)
click to toggle source
# File lib/tkextlib/tile/treeview.rb, line 811 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 799 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 730 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