# File tk/lib/tkextlib/tile/treeview.rb, line 26
def __itemconfiginfo_core(tagOrId, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if (slot && slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
fontkey = $2
return [slot.to_s, tagfontobj(tagid(tagOrId), fontkey)]
else
if slot
slot = slot.to_s
alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
if real_name
slot = real_name.to_s
end
case slot
when /^(#{__tile_specific_item_optkeys(tagid(tagOrId)).join('|')})$/
begin
# On tile-0.7.{2-8}, 'state' options has no '-' at its head.
val = tk_call(*(__item_confinfo_cmd(tagid(tagOrId)) << slot))
rescue
# Maybe, 'state' option has '-' in future.
val = tk_call(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
end
return [slot, val]
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
optval = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
begin
val = method.call(tagOrId, optval)
rescue => e
warn("Warning:: #{e.message} (when #{method}lcall(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
val = optval
end
return [slot, val]
when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
return [slot, self.__send__(method, tagOrId)]
when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
begin
val = number(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
rescue
val = nil
end
return [slot, val]
when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
val = num_or_str(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
return [slot, val]
when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
begin
val = bool(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
rescue
val = nil
end
return [slot, val]
when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
val = simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
return [slot, val]
when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
if val =~ /^[0-9]/
return [slot, list(val)]
else
return [slot, val]
end
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
return [slot, val]
when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
if val.empty?
return [slot, nil]
else
return [slot, TkVarAccess.new(val)]
end
else
val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
if val.index('{')
return [slot, tk_split_list(val)]
else
return [slot, tk_tcl2ruby(val)]
end
end
else # ! slot
ret = Hash[*(tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false))].to_a.collect{|conf|
conf[0] = conf[0][1..-1] if conf[0][0] == ?-
case conf[0]
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[conf[0]]
optval = conf[1]
begin
val = method.call(tagOrId, optval)
rescue => e
warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
val = optval
end
conf[1] = val
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
# do nothing
when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
begin
conf[1] = number(conf[1])
rescue
conf[1] = nil
end
when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
conf[1] = num_or_str(conf[1])
when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
begin
conf[1] = bool(conf[1])
rescue
conf[1] = nil
end
when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
conf[1] = simplelist(conf[1])
when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
if conf[1] =~ /^[0-9]/
conf[1] = list(conf[1])
end
when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
if conf[1].empty?
conf[1] = nil
else
conf[1] = TkVarAccess.new(conf[1])
end
else
if conf[1].index('{')
conf[1] = tk_split_list(conf[1])
else
conf[1] = tk_tcl2ruby(conf[1])
end
end
conf
}
__item_font_optkeys(tagid(tagOrId)).each{|optkey|
optkey = optkey.to_s
fontconf = ret.assoc(optkey)
if fontconf
ret.delete_if{|inf| inf[0] =~ /^(|latin|ascii|kanji)#{optkey}$/}
fontconf[1] = tagfontobj(tagid(tagOrId), optkey)
ret.push(fontconf)
end
}
__item_methodcall_optkeys(tagid(tagOrId)).each{|optkey, method|
ret << [optkey.to_s, self.__send__(method, tagOrId)]
}
ret
end
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
if (slot && slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
fontkey = $2
return {slot.to_s => tagfontobj(tagid(tagOrId), fontkey)}
else
if slot
slot = slot.to_s
alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
if real_name
slot = real_name.to_s
end
case slot
when /^(#{__tile_specific_item_optkeys(tagid(tagOrId)).join('|')})$/
begin
# On tile-0.7.{2-8}, 'state' option has no '-' at its head.
val = tk_call(*(__item_confinfo_cmd(tagid(tagOrId)) << slot))
rescue
# Maybe, 'state' option has '-' in future.
val = tk_call(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
end
return {slot => val}
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
optval = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
begin
val = method.call(tagOrId, optval)
rescue => e
warn("Warning:: #{e.message} (when #{method}lcall(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
val = optval
end
return {slot => val}
when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
return {slot => self.__send__(method, tagOrId)}
when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
begin
val = number(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
rescue
val = nil
end
return {slot => val}
when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
val = num_or_str(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
return {slot => val}
when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
begin
val = bool(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
rescue
val = nil
end
return {slot => val}
when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
val = simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
return {slot => val}
when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
if val =~ /^[0-9]/
return {slot => list(val)}
else
return {slot => val}
end
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
return {slot => val}
when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
if val.empty?
return {slot => nil}
else
return {slot => TkVarAccess.new(val)}
end
else
val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
if val.index('{')
return {slot => tk_split_list(val)}
else
return {slot => tk_tcl2ruby(val)}
end
end
else # ! slot
ret = {}
ret = Hash[*(tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false))].to_a.collect{|conf|
conf[0] = conf[0][1..-1] if conf[0][0] == ?-
optkey = conf[0]
case optkey
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[optkey]
optval = conf[1]
begin
val = method.call(tagOrId, optval)
rescue => e
warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
val = optval
end
conf[1] = val
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
# do nothing
when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
begin
conf[1] = number(conf[1])
rescue
conf[1] = nil
end
when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
conf[1] = num_or_str(conf[1])
when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
begin
conf[1] = bool(conf[1])
rescue
conf[1] = nil
end
when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
conf[1] = simplelist(conf[1])
when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
if conf[1] =~ /^[0-9]/
conf[1] = list(conf[1])
end
when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
if conf[1].empty?
conf[1] = nil
else
conf[1] = TkVarAccess.new(conf[1])
end
else
if conf[1].index('{')
return [slot, tk_split_list(conf[1])]
else
return [slot, tk_tcl2ruby(conf[1])]
end
end
ret[conf[0]] = conf[1]
}
__item_font_optkeys(tagid(tagOrId)).each{|optkey|
optkey = optkey.to_s
fontconf = ret[optkey]
if fontconf.kind_of?(Array)
ret.delete(optkey)
ret.delete('latin' << optkey)
ret.delete('ascii' << optkey)
ret.delete('kanji' << optkey)
fontconf[1] = tagfontobj(tagid(tagOrId), optkey)
ret[optkey] = fontconf
end
}
__item_methodcall_optkeys(tagid(tagOrId)).each{|optkey, method|
ret[optkey.to_s] = self.__send__(method, tagOrId)
}
ret
end
end
end
end
# File tk/lib/tkextlib/tile/treeview.rb, line 469
def __tile_specific_item_optkeys(id)
case id[0]
when :item, 'item'
[]
when :column, 'column'
[]
when :heading, 'heading'
['state'] # On tile-0.7.{2-8}, 'state' options has no '-' at its head.
else
[]
end
end
# File tk/lib/tkextlib/tile/treeview.rb, line 554
def columncget(tagOrId, option)
__itemcget([:column, tagOrId], option)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 557
def columncget_strict(tagOrId, option)
__itemcget_strict([:column, tagOrId], option)
end
Treeview Column
# File tk/lib/tkextlib/tile/treeview.rb, line 551
def columncget_tkstring(tagOrId, option)
__itemcget_tkstring([:column, tagOrId], option)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 563
def columnconfiginfo(tagOrId, slot=nil)
__itemconfiginfo([:column, tagOrId], slot)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 560
def columnconfigure(tagOrId, slot, value=None)
__itemconfigure([:column, tagOrId], slot, value)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 566
def current_columnconfiginfo(tagOrId, slot=nil)
__current_itemconfiginfo([:column, tagOrId], slot)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 649
def current_headingconfiginfo(tagOrId, slot=nil)
__current_itemconfiginfo([:heading, tagOrId], slot)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 487
def current_itemconfiginfo(tagOrId, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
org_slot = slot
begin
conf = __itemconfiginfo_core(tagOrId, slot)
if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
return {conf[0] => conf[-1]}
end
slot = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]]
end while(org_slot != slot)
fail RuntimeError,
"there is a configure alias loop about '#{org_slot}'"
else
ret = {}
__itemconfiginfo_core(tagOrId).each{|conf|
if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
ret[conf[0]] = conf[-1]
end
}
ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {}
__itemconfiginfo_core(tagOrId, slot).each{|key, conf|
ret[key] = conf[-1] if conf.kind_of?(Array)
}
ret
end
end
# File tk/lib/tkextlib/tile/treeview.rb, line 675
def current_tagconfiginfo(tagOrId, slot=nil)
__current_itemconfiginfo([:tag, :configure, tagOrId], slot)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 603
def headingcget(tagOrId, option)
unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
headingcget_strict(tagOrId, option)
else
begin
headingcget_strict(tagOrId, option)
rescue => e
begin
if current_headingconfiginfo(tagOrId).has_key?(option.to_s)
# not tag error & option is known -> error on known option
fail e
else
# not tag error & option is unknown
nil
end
rescue
fail e # tag error
end
end
end
end
# File tk/lib/tkextlib/tile/treeview.rb, line 590
def headingcget_strict(tagOrId, option)
if __tile_specific_item_optkeys([:heading, tagOrId]).index(option.to_s)
begin
# On tile-0.7.{2-8}, 'state' options has no '-' at its head.
tk_call(*(__item_cget_cmd([:heading, tagOrId]) << option.to_s))
rescue
# Maybe, 'state' option has '-' in future.
tk_call(*(__item_cget_cmd([:heading, tagOrId]) << "-#{option}"))
end
else
__itemcget_strict([:heading, tagOrId], option)
end
end
Treeview Heading
# File tk/lib/tkextlib/tile/treeview.rb, line 577
def headingcget_tkstring(tagOrId, option)
if __tile_specific_item_optkeys([:heading, tagOrId]).index(option.to_s)
begin
# On tile-0.7.{2-8}, 'state' options has no '-' at its head.
tk_call(*(__item_cget_cmd([:heading, tagOrId]) << option.to_s))
rescue
# Maybe, 'state' option has '-' in future.
tk_call(*(__item_cget_cmd([:heading, tagOrId]) << "-#{option}"))
end
else
__itemcget_tkstring([:heading, tagOrId], option)
end
end
# File tk/lib/tkextlib/tile/treeview.rb, line 646
def headingconfiginfo(tagOrId, slot=nil)
__itemconfiginfo([:heading, tagOrId], slot)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 624
def headingconfigure(tagOrId, slot, value=None)
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
sp_kv = []
__tile_specific_item_optkeys([:heading, tagOrId]).each{|k|
sp_kv << k << _get_eval_string(slot.delete(k)) if slot.has_key?(k)
}
tk_call(*(__item_config_cmd([:heading, tagOrId]).concat(sp_kv)))
tk_call(*(__item_config_cmd([:heading, tagOrId]).concat(hash_kv(slot))))
elsif __tile_specific_item_optkeys([:heading, tagOrId]).index(slot.to_s)
begin
# On tile-0.7.{2-8}, 'state' options has no '-' at its head.
tk_call(*(__item_cget_cmd([:heading, tagOrId]) << slot.to_s << value))
rescue
# Maybe, 'state' option has '-' in future.
tk_call(*(__item_cget_cmd([:heading, tagOrId]) << "-#{slot}" << value))
end
else
__itemconfigure([:heading, tagOrId], slot, value)
end
self
end
# File tk/lib/tkextlib/tile/treeview.rb, line 534
def itemcget(tagOrId, option)
__itemcget([:item, tagOrId], option)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 537
def itemcget_strict(tagOrId, option)
__itemcget_strict([:item, tagOrId], option)
end
Treeview Item
# File tk/lib/tkextlib/tile/treeview.rb, line 531
def itemcget_tkstring(tagOrId, option)
__itemcget_tkstring([:item, tagOrId], option)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 483
def itemconfiginfo(tagOrId, slot = nil)
__itemconfiginfo_core(tagOrId, slot)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 540
def itemconfigure(tagOrId, slot, value=None)
__itemconfigure([:item, tagOrId], slot, value)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 663
def tagcget(tagOrId, option)
__itemcget([:tag, :configure, tagOrId], option)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 666
def tagcget_strict(tagOrId, option)
__itemcget_strict([:tag, :configure, tagOrId], option)
end
Treeview Tag
# File tk/lib/tkextlib/tile/treeview.rb, line 660
def tagcget_tkstring(tagOrId, option)
__itemcget_tkstring([:tag, :configure, tagOrId], option)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 672
def tagconfiginfo(tagOrId, slot=nil)
__itemconfiginfo([:tag, :configure, tagOrId], slot)
end
# File tk/lib/tkextlib/tile/treeview.rb, line 669
def tagconfigure(tagOrId, slot, value=None)
__itemconfigure([:tag, :configure, tagOrId], slot, value)
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.