#
# tkextlib/blt/treeview.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
#
require 'tk'
require 'tkextlib/blt.rb'
require 'tk/validation.rb'
module Tk::BLT
class Treeview < TkWindow
module ConfigMethod
end
module TagOrID_Methods
end
class Node < TkObject
end
class Tag < TkObject
end
end
class Hiertable < Treeview
end
end
######################################
module Tk::BLT::Treeview::ConfigMethod
include TkItemConfigMethod
def __item_boolval_optkeys(id)
case id
when Array
# id := [ 'column', name ]
['edit', 'hide']
when 'sort'
['decreasing']
else
[]
end
end
private :__item_boolval_optkeys
def __item_strval_optkeys(id)
case id
when Array
# id := [ 'column', name ]
super() << 'titleforeground' << 'titleshadow'
when 'sort'
['decreasing']
else
[]
end
end
private :__item_strval_optkeys
def __item_listval_optkeys(id)
case id
when 'entry'
['bindtags']
else
[]
end
end
private :__item_listval_optkeys
def __item_cget_cmd(id)
if id.kind_of?(Array)
# id := [ type, name ]
[self.path, id[0], 'cget', id[1]]
else
[self.path, id, 'cget']
end
end
private :__item_cget_cmd
def __item_config_cmd(id)
if id.kind_of?(Array)
# id := [ type, name ]
[self.path, id[0], 'configure', id[1]]
else
[self.path, id, 'configure']
end
end
private :__item_config_cmd
def __item_pathname(id)
if id.kind_of?(Array)
id = tagid(id[1])
end
[self.path, id].join(';')
end
private :__item_pathname
def column_cget_tkstring(name, option)
itemcget_tkstring(['column', name], option)
end
def column_cget(name, option)
itemcget(['column', name], option)
end
def column_cget_strict(name, option)
itemcget_strict(['column', name], option)
end
def column_configure(name, slot, value=None)
itemconfigure(['column', name], slot, value)
end
def column_configinfo(name, slot=nil)
itemconfiginfo(['column', name], slot)
end
def current_column_configinfo(name, slot=nil)
current_itemconfiginfo(['column', name], slot)
end
def button_cget_tkstring(option)
itemcget_tkstring('button', option)
end
def button_cget(option)
itemcget('button', option)
end
def button_cget_strict(option)
itemcget_strict('button', option)
end
def button_configure(slot, value=None)
itemconfigure('button', slot, value)
end
def button_configinfo(slot=nil)
itemconfiginfo('button', slot)
end
def current_button_configinfo(slot=nil)
current_itemconfiginfo('button', slot)
end
def entry_cget_tkstring(option)
itemcget_tkstring('entry', option)
end
def entry_cget(option)
ret = itemcget('entry', option)
if option == 'bindtags' || option == :bindtags
ret.collect{|tag| TkBindTag.id2obj(tag)}
else
ret
end
end
def entry_cget_strict(option)
ret = itemcget_strict('entry', option)
if option == 'bindtags' || option == :bindtags
ret.collect{|tag| TkBindTag.id2obj(tag)}
else
ret
end
end
def entry_configure(slot, value=None)
itemconfigure('entry', slot, value)
end
def entry_configinfo(slot=nil)
ret = itemconfiginfo('entry', slot)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
if slot == 'bindtags' || slot == :bindtags
ret[-2] = ret[-2].collect{|tag| TkBindTag.id2obj(tag)}
ret[-1] = ret[-1].collect{|tag| TkBindTag.id2obj(tag)}
end
else
inf = ret.assoc('bindtags')
inf[-2] = inf[-2].collect{|tag| TkBindTag.id2obj(tag)}
inf[-1] = inf[-1].collect{|tag| TkBindTag.id2obj(tag)}
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
if (inf = ret['bindtags'])
inf[-2] = inf[-2].collect{|tag| TkBindTag.id2obj(tag)}
inf[-1] = inf[-1].collect{|tag| TkBindTag.id2obj(tag)}
ret['bindtags'] = inf
end
end
ret
end
def current_entry_configinfo(slot=nil)
ret = current_itemconfiginfo('entry', slot)
if (val = ret['bindtags'])
ret['bindtags'] = val.collect{|tag| TkBindTag.id2obj(tag)}
end
ret
end
def sort_cget_tkstring(option)
itemcget_tkstring('sort', option)
end
def sort_cget(option)
itemcget('sort', option)
end
def sort_cget_strict(option)
itemcget_strict('sort', option)
end
def sort_configure(slot, value=None)
itemconfigure('sort', slot, value)
end
def sort_configinfo(slot=nil)
itemconfiginfo('sort', slot)
end
def current_sort_configinfo(slot=nil)
current_itemconfiginfo('sort', slot)
|