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
3605
3606
3607
|
# File 'lib/tk.rb', line 3605
def TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
@mode || false
end
|
3608
3609
3610
|
# File 'lib/tk.rb', line 3608
def TkConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode)
@mode = (mode)? true: false
end
|
Instance Method Details
3735
3736
3737
|
# File 'lib/tk.rb', line 3735
def [](id)
cget(id)
end
|
#[]=(id, val) ⇒ Object
3739
3740
3741
3742
|
# File 'lib/tk.rb', line 3739
def []=(id, val)
configure(id, val)
val
end
|
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
|
# File 'lib/tk.rb', line 3932
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
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
|
# File 'lib/tk.rb', line 3833
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
3850
3851
3852
3853
|
# File 'lib/tk.rb', line 3850
def cget_strict(slot)
__cget_core(slot)
end
|
#cget_tkstring(option) ⇒ Object
3744
3745
3746
3747
3748
|
# File 'lib/tk.rb', line 3744
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
3729
3730
3731
|
# File 'lib/tk.rb', line 3729
def config_hash_kv(keys, enc_mode = nil, conf = nil)
hash_kv(__conv_keyonly_opts(keys), enc_mode, conf)
end
|
#configinfo(slot = nil) ⇒ Object
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
|
# File 'lib/tk.rb', line 4743
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
|
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
|
# File 'lib/tk.rb', line 3946
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
|
3974
3975
3976
|
# File 'lib/tk.rb', line 3974
def configure_cmd(slot, value)
configure(slot, install_cmd(value))
end
|
#current_configinfo(slot = nil) ⇒ Object
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
|
# File 'lib/tk.rb', line 4755
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
|