Module: TkConfigMethod
Constant Summary
Constants included
from TkUtil
TkUtil::None, TkUtil::RELEASE_DATE
Class Method Summary
collapse
Instance Method Summary
collapse
#font_configinfo, #font_configure, #font_copy, #kanjifont_configure, #kanjifont_copy, #latinfont_configure, #latinfont_copy
Methods included from TkUtil
#_conv_args, _conv_args, #_fromUTF8, #_get_eval_enc_str, _get_eval_enc_str, #_get_eval_string, _get_eval_string, _symbolkey2str, #_symbolkey2str, #_toUTF8, #bool, bool, callback, eval_cmd, #hash_kv, hash_kv, install_cmd, #num_or_nil, num_or_nil, num_or_str, #num_or_str, number, #number, string, #string, uninstall_cmd, untrust
Class Method Details
3654
3655
3656
|
# File 'lib/tk.rb', line 3654
def TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
@mode || false
end
|
3657
3658
3659
|
# File 'lib/tk.rb', line 3657
def TkConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode)
@mode = (mode)? true: false
end
|
Instance Method Details
3784
3785
3786
|
# File 'lib/tk.rb', line 3784
def [](id)
cget(id)
end
|
#[]=(id, val) ⇒ Object
3788
3789
3790
3791
|
# File 'lib/tk.rb', line 3788
def []=(id, val)
configure(id, val)
val
end
|
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
|
# File 'lib/tk.rb', line 3981
def __check_available_configure_options(keys)
availables = self.current_configinfo.keys
availables |= __font_optkeys.map{|k|
[k.to_s, "latin#{k}", "ascii#{k}", "kanji#{k}"]
}.flatten
availables |= __methodcall_optkeys.keys.map{|k| k.to_s}
availables |= __keyonly_optkeys.keys.map{|k| k.to_s}
keys = _symbolkey2str(keys)
keys.delete_if{|k, v| !(availables.include?(k))}
end
|
#cget(slot) ⇒ Object
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
|
# File 'lib/tk.rb', line 3882
def cget(slot)
unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
__cget_core(slot)
else
begin
__cget_core(slot)
rescue => e
if current_configinfo.has_key?(slot.to_s)
fail e
else
nil
end
end
end
end
|
#cget_strict(slot) ⇒ Object
3899
3900
3901
3902
|
# File 'lib/tk.rb', line 3899
def cget_strict(slot)
__cget_core(slot)
end
|
#cget_tkstring(option) ⇒ Object
3793
3794
3795
3796
3797
|
# File 'lib/tk.rb', line 3793
def cget_tkstring(option)
opt = option.to_s
fail ArgumentError, "Invalid option `#{option.inspect}'" if opt.length == 0
tk_call_without_enc(*(__cget_cmd << "-#{opt}"))
end
|
#config_hash_kv(keys, enc_mode = nil, conf = nil) ⇒ Object
3778
3779
3780
|
# File 'lib/tk.rb', line 3778
def config_hash_kv(keys, enc_mode = nil, conf = nil)
hash_kv(__conv_keyonly_opts(keys), enc_mode, conf)
end
|
#configinfo(slot = nil) ⇒ Object
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
|
# File 'lib/tk.rb', line 4792
def configinfo(slot = nil)
if slot && TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
begin
__configinfo_core(slot)
rescue
Array.new(__configinfo_struct.values.max).unshift(slot.to_s)
end
else
__configinfo_core(slot)
end
end
|
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
|
# File 'lib/tk.rb', line 3995
def configure(slot, value=None)
unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
__configure_core(slot, value)
else
if slot.kind_of?(Hash)
begin
__configure_core(slot)
rescue
slot = __check_available_configure_options(slot)
__configure_core(slot) unless slot.empty?
end
else
begin
__configure_core(slot, value)
rescue => e
if current_configinfo.has_key?(slot.to_s)
fail e
else
nil
end
end
end
end
self
end
|
4023
4024
4025
|
# File 'lib/tk.rb', line 4023
def configure_cmd(slot, value)
configure(slot, install_cmd(value))
end
|
#current_configinfo(slot = nil) ⇒ Object
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
|
# File 'lib/tk.rb', line 4804
def current_configinfo(slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
org_slot = slot
begin
conf = configinfo(slot)
if ( ! __configinfo_struct[:alias] \
|| conf.size > __configinfo_struct[:alias] + 1 )
return {conf[0] => conf[-1]}
end
slot = conf[__configinfo_struct[:alias]]
end while(org_slot != slot)
fail RuntimeError,
"there is a configure alias loop about '#{org_slot}'"
else
ret = {}
configinfo().each{|cnf|
if ( ! __configinfo_struct[:alias] \
|| cnf.size > __configinfo_struct[:alias] + 1 )
ret[cnf[0]] = cnf[-1]
end
}
ret
end
else ret = {}
configinfo(slot).each{|key, cnf|
ret[key] = cnf[-1] if cnf.kind_of?(Array)
}
ret
end
end
|