Module: TkConfigMethod

Module | TkConfigMethod
In: | tk/lib/tk.rb

### Methods

[] []= __confinfo_cmd __conv_keyonly_opts cget config_hash_kv configinfo configure configure_cmd current_configinfo

### Included Modules

TkUtil TkTreatFont

### Public Instance methods

[](id)

[Source]

    # File tk/lib/tk.rb, line 2785
      def [](id)
        cget(id)
      end

[]=(id, val)

[Source]

    # File tk/lib/tk.rb, line 2789
      def []=(id, val)
        configure(id, val)
        val
      end

__confinfo_cmd()

[Source]

    # File tk/lib/tk.rb, line 2678
      def __confinfo_cmd
        __config_cmd
      end

__conv_keyonly_opts(keys)

[Source]

    # File tk/lib/tk.rb, line 2757
      def __conv_keyonly_opts(keys)
        return keys unless keys.kind_of?(Hash)
        keyonly = __keyonly_optkeys
        keys2 = {}
        keys.each{|k, v|
          optkey = keyonly.find{|kk,vv| kk.to_s == k.to_s}
          if optkey
            defkey, undefkey = optkey
            if v
              keys2[defkey.to_s] = None
            elsif undefkey
              keys2[undefkey.to_s] = None
            else
              # remove key
            end
          else
            keys2[k.to_s] = v
          end
        }
        keys2
      end

cget(slot)

[Source]

    # File tk/lib/tk.rb, line 2794
      def cget(slot)
        orig_slot = slot
        slot = slot.to_s

       if slot.length == 0
          fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
        end

        if ( method = _symbolkey2str(__val2ruby_optkeys())[slot] )
          optval = tk_call_without_enc(*(__cget_cmd << "-#{slot}"))
          begin
            return method.call(optval)
          rescue => e
            warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
            return optval
          end
        end

        if ( method = _symbolkey2str(__methodcall_optkeys)[slot] )
          return self.__send__(method)
        end

        case slot
        when /^(#{__numval_optkeys.join('|')})$/
          begin
            number(tk_call_without_enc(*(__cget_cmd << "-#{slot}")))
          rescue
            nil
          end

        when /^(#{__numstrval_optkeys.join('|')})$/
          num_or_str(tk_call_without_enc(*(__cget_cmd << "-#{slot}")))

        when /^(#{__boolval_optkeys.join('|')})$/
          begin
            bool(tk_call_without_enc(*(__cget_cmd << "-#{slot}")))
          rescue
            nil
          end

        when /^(#{__listval_optkeys.join('|')})$/
          simplelist(tk_call_without_enc(*(__cget_cmd << "-#{slot}")))

        when /^(#{__numlistval_optkeys.join('|')})$/
          conf = tk_call_without_enc(*(__cget_cmd << "-#{slot}"))
          if conf =~ /^[0-9+-]/
            list(conf)
          else
            conf
          end

        when /^(#{__strval_optkeys.join('|')})$/
          _fromUTF8(tk_call_without_enc(*(__cget_cmd << "-#{slot}")))

        when /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/
          fontcode = $1
          fontkey  = $2
          fnt = tk_tcl2ruby(tk_call_without_enc(*(__cget_cmd << "-#{fontkey}")), true)
          unless fnt.kind_of?(TkFont)
            fnt = fontobj(fontkey)
          end
          if fontcode == 'kanji' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
            # obsolete; just for compatibility
            fnt.kanji_font
          else
            fnt
          end

        when /^(#{__tkvariable_optkeys.join('|')})$/
          v = tk_call_without_enc(*(__cget_cmd << "-#{slot}"))
          (v.empty?)? nil: TkVarAccess.new(v)

        else
          tk_tcl2ruby(tk_call_without_enc(*(__cget_cmd << "-#{slot}")), true)
        end
      end

config_hash_kv(keys, enc_mode = nil, conf = nil)

[Source]

    # File tk/lib/tk.rb, line 2779
      def config_hash_kv(keys, enc_mode = nil, conf = nil)
        hash_kv(__conv_keyonly_opts(keys), enc_mode, conf)
      end

configinfo(slot = nil)

[Source]

    # File tk/lib/tk.rb, line 2939
      def configinfo(slot = nil)
        if TkComm::GET_CONFIGINFO_AS_ARRAY
          if (slot &&
              slot.to_s =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
            fontkey  = $2
            # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}"))))
            conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}")), false, true)
            conf[__configinfo_struct[:key]] =
              conf[__configinfo_struct[:key]][1..-1]
            if ( ! __configinfo_struct[:alias] \
                || conf.size > __configinfo_struct[:alias] + 1 )
              conf[__configinfo_struct[:current_value]] = fontobj(fontkey)
            elsif ( __configinfo_struct[:alias] \
                   && conf.size == __configinfo_struct[:alias] + 1 \
                   && conf[__configinfo_struct[:alias]][0] == ?- )
              conf[__configinfo_struct[:alias]] =
                conf[__configinfo_struct[:alias]][1..-1]
            end
            conf
          else
            if slot
              slot = slot.to_s
              case slot
              when /^(#{__val2ruby_optkeys().keys.join('|')})$/
                method = _symbolkey2str(__val2ruby_optkeys())[slot]
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd() << "-#{slot}")), false, true)
                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]] )
                  optval = conf[__configinfo_struct[:default_value]]
                  begin
                    val = method.call(optval)
                  rescue => e
                    warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
                    val = optval
                  end
                  conf[__configinfo_struct[:default_value]] = val
                end
                if ( conf[__configinfo_struct[:current_value]] )
                  optval = conf[__configinfo_struct[:current_value]]
                  begin
                    val = method.call(optval)
                  rescue => e
                    warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
                    val = optval
                  end
                  conf[__configinfo_struct[:current_value]] = val
                end

              when /^(#{__methodcall_optkeys.keys.join('|')})$/
                method = _symbolkey2str(__methodcall_optkeys)[slot]
                return [slot, '', '', '', self.__send__(method)]

              when /^(#{__numval_optkeys.join('|')})$/
                # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)

                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]])
                  begin
                    conf[__configinfo_struct[:default_value]] =
                      number(conf[__configinfo_struct[:default_value]])
                  rescue
                    conf[__configinfo_struct[:default_value]] = nil
                  end
                end
                if ( conf[__configinfo_struct[:current_value]] )
                  begin
                    conf[__configinfo_struct[:current_value]] =
                      number(conf[__configinfo_struct[:current_value]])
                  rescue
                    conf[__configinfo_struct[:current_value]] = nil
                  end
                end

              when /^(#{__numstrval_optkeys.join('|')})$/
                # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)

                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]])
                  conf[__configinfo_struct[:default_value]] =
                    num_or_str(conf[__configinfo_struct[:default_value]])
                end
                if ( conf[__configinfo_struct[:current_value]] )
                  conf[__configinfo_struct[:current_value]] =
                    num_or_str(conf[__configinfo_struct[:current_value]])
                end

              when /^(#{__boolval_optkeys.join('|')})$/
                # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)

                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]])
                  begin
                    conf[__configinfo_struct[:default_value]] =
                      bool(conf[__configinfo_struct[:default_value]])
                  rescue
                    conf[__configinfo_struct[:default_value]] = nil
                  end
                end
                if ( conf[__configinfo_struct[:current_value]] )
                  begin
                    conf[__configinfo_struct[:current_value]] =
                      bool(conf[__configinfo_struct[:current_value]])
                  rescue
                    conf[__configinfo_struct[:current_value]] = nil
                  end
                end

              when /^(#{__listval_optkeys.join('|')})$/
                # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)

                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]])
                  conf[__configinfo_struct[:default_value]] =
                    simplelist(conf[__configinfo_struct[:default_value]])
                end
                if ( conf[__configinfo_struct[:current_value]] )
                  conf[__configinfo_struct[:current_value]] =
                    simplelist(conf[__configinfo_struct[:current_value]])
                end

              when /^(#{__numlistval_optkeys.join('|')})$/
                # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)

                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]] \
                    && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ )
                  conf[__configinfo_struct[:default_value]] =
                    list(conf[__configinfo_struct[:default_value]])
                end
                if ( conf[__configinfo_struct[:current_value]] \
                    && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ )
                  conf[__configinfo_struct[:current_value]] =
                    list(conf[__configinfo_struct[:current_value]])
                end

              when /^(#{__strval_optkeys.join('|')})$/
                # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)

              when /^(#{__tkvariable_optkeys.join('|')})$/
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)

                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]])
                  v = conf[__configinfo_struct[:default_value]]
                  if v.empty?
                    conf[__configinfo_struct[:default_value]] = nil
                  else
                    conf[__configinfo_struct[:default_value]] = TkVarAccess.new(v)
                  end
                end
                if ( conf[__configinfo_struct[:current_value]] )
                  v = conf[__configinfo_struct[:current_value]]
                  if v.empty?
                    conf[__configinfo_struct[:current_value]] = nil
                  else
                    conf[__configinfo_struct[:current_value]] = TkVarAccess.new(v)
                  end
                end

              else
                # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_list(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), 0, false, true)
              end
              conf[__configinfo_struct[:key]] =
                conf[__configinfo_struct[:key]][1..-1]

              if ( __configinfo_struct[:alias] \
                  && conf.size == __configinfo_struct[:alias] + 1 \
                  && conf[__configinfo_struct[:alias]][0] == ?- )
                conf[__configinfo_struct[:alias]] =
                  conf[__configinfo_struct[:alias]][1..-1]
              end

              conf

            else
              # ret = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*__confinfo_cmd))).collect{|conflist|
              #  conf = tk_split_simplelist(conflist)
              ret = tk_split_simplelist(tk_call_without_enc(*__confinfo_cmd), false, false).collect{|conflist|
                conf = tk_split_simplelist(conflist, false, true)
                conf[__configinfo_struct[:key]] =
                  conf[__configinfo_struct[:key]][1..-1]

                optkey = conf[__configinfo_struct[:key]]
                case optkey
                when /^(#{__val2ruby_optkeys().keys.join('|')})$/
                  method = _symbolkey2str(__val2ruby_optkeys())[optkey]
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    optval = conf[__configinfo_struct[:default_value]]
                    begin
                      val = method.call(optval)
                    rescue => e
                      warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
                      val = optval
                    end
                    conf[__configinfo_struct[:default_value]] = val
                  end
                  if ( conf[__configinfo_struct[:current_value]] )
                    optval = conf[__configinfo_struct[:current_value]]
                    begin
                      val = method.call(optval)
                    rescue => e
                      warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
                      val = optval
                    end
                    conf[__configinfo_struct[:current_value]] = val
                  end

                when /^(#{__strval_optkeys.join('|')})$/
                  # do nothing

                when /^(#{__numval_optkeys.join('|')})$/
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    begin
                      conf[__configinfo_struct[:default_value]] =
                        number(conf[__configinfo_struct[:default_value]])
                    rescue
                      conf[__configinfo_struct[:default_value]] = nil
                    end
                  end
                  if ( conf[__configinfo_struct[:current_value]] )
                    begin
                      conf[__configinfo_struct[:current_value]] =
                        number(conf[__configinfo_struct[:current_value]])
                    rescue
                      conf[__configinfo_struct[:current_value]] = nil
                    end
                  end

                when /^(#{__numstrval_optkeys.join('|')})$/
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    conf[__configinfo_struct[:default_value]] =
                      num_or_str(conf[__configinfo_struct[:default_value]])
                  end
                  if ( conf[__configinfo_struct[:current_value]] )
                    conf[__configinfo_struct[:current_value]] =
                      num_or_str(conf[__configinfo_struct[:current_value]])
                  end

                when /^(#{__boolval_optkeys.join('|')})$/
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    begin
                      conf[__configinfo_struct[:default_value]] =
                        bool(conf[__configinfo_struct[:default_value]])
                    rescue
                      conf[__configinfo_struct[:default_value]] = nil
                    end
                  end
                  if ( conf[__configinfo_struct[:current_value]] )
                    begin
                      conf[__configinfo_struct[:current_value]] =
                        bool(conf[__configinfo_struct[:current_value]])
                    rescue
                      conf[__configinfo_struct[:current_value]] = nil
                    end
                  end

                when /^(#{__listval_optkeys.join('|')})$/
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    conf[__configinfo_struct[:default_value]] =
                      simplelist(conf[__configinfo_struct[:default_value]])
                  end
                  if ( conf[__configinfo_struct[:current_value]] )
                    conf[__configinfo_struct[:current_value]] =
                      simplelist(conf[__configinfo_struct[:current_value]])
                  end

                when /^(#{__numlistval_optkeys.join('|')})$/
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] \
                      && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ )
                    conf[__configinfo_struct[:default_value]] =
                      list(conf[__configinfo_struct[:default_value]])
                  end
                  if ( conf[__configinfo_struct[:current_value]] \
                      && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ )
                    conf[__configinfo_struct[:current_value]] =
                      list(conf[__configinfo_struct[:current_value]])
                  end

                when /^(#{__tkvariable_optkeys.join('|')})$/
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    v = conf[__configinfo_struct[:default_value]]
                    if v.empty?
                      conf[__configinfo_struct[:default_value]] = nil
                    else
                      conf[__configinfo_struct[:default_value]] = TkVarAccess.new(v)
                    end
                  end
                  if ( conf[__configinfo_struct[:current_value]] )
                    v = conf[__configinfo_struct[:current_value]]
                    if v.empty?
                      conf[__configinfo_struct[:current_value]] = nil
                    else
                      conf[__configinfo_struct[:current_value]] = TkVarAccess.new(v)
                    end
                  end

                else
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    if conf[__configinfo_struct[:default_value]].index('{')
                      conf[__configinfo_struct[:default_value]] =
                        tk_split_list(conf[__configinfo_struct[:default_value]])
                    else
                      conf[__configinfo_struct[:default_value]] =
                        tk_tcl2ruby(conf[__configinfo_struct[:default_value]])
                    end
                  end
                  if conf[__configinfo_struct[:current_value]]
                    if conf[__configinfo_struct[:current_value]].index('{')
                      conf[__configinfo_struct[:current_value]] =
                        tk_split_list(conf[__configinfo_struct[:current_value]])
                    else
                      conf[__configinfo_struct[:current_value]] =
                        tk_tcl2ruby(conf[__configinfo_struct[:current_value]])
                    end
                  end
                end

                if ( __configinfo_struct[:alias] \
                    && conf.size == __configinfo_struct[:alias] + 1 \
                    && conf[__configinfo_struct[:alias]][0] == ?- )
                  conf[__configinfo_struct[:alias]] =
                    conf[__configinfo_struct[:alias]][1..-1]
                end

                conf
              }

              __font_optkeys.each{|optkey|
                optkey = optkey.to_s
                fontconf = ret.assoc(optkey)
                if fontconf && fontconf.size > 2
                  ret.delete_if{|inf| inf[0] =~ /^(|latin|ascii|kanji)#{optkey}$/}
                  fontconf[__configinfo_struct[:current_value]] = fontobj(optkey)
                  ret.push(fontconf)
                end
              }

              __methodcall_optkeys.each{|optkey, method|
                ret << [optkey.to_s, '', '', '', self.__send__(method)]
              }

              ret
            end
          end

        else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
          if (slot &&
              slot.to_s =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
            fontkey  = $2
            # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}"))))
            conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}")), false, true)
            conf[__configinfo_struct[:key]] =
              conf[__configinfo_struct[:key]][1..-1]

            if ( ! __configinfo_struct[:alias] \
                || conf.size > __configinfo_struct[:alias] + 1 )
              conf[__configinfo_struct[:current_value]] = fontobj(fontkey)
              { conf.shift => conf }
            elsif ( __configinfo_struct[:alias] \
                   && conf.size == __configinfo_struct[:alias] + 1 )
              if conf[__configinfo_struct[:alias]][0] == ?-
                conf[__configinfo_struct[:alias]] =
                  conf[__configinfo_struct[:alias]][1..-1]
              end
              { conf[0] => conf[1] }
            else
              { conf.shift => conf }
            end
          else
            if slot
              slot = slot.to_s
              case slot
              when /^(#{__val2ruby_optkeys().keys.join('|')})$/
                method = _symbolkey2str(__val2ruby_optkeys())[slot]
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]] )
                  optval = conf[__configinfo_struct[:default_value]]
                  begin
                    val = method.call(optval)
                  rescue => e
                    warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
                    val = optval
                  end
                  conf[__configinfo_struct[:default_value]] = val
                end
                if ( conf[__configinfo_struct[:current_value]] )
                  optval = conf[__configinfo_struct[:current_value]]
                  begin
                    val = method.call(optval)
                  rescue => e
                    warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
                    val = optval
                  end
                  conf[__configinfo_struct[:current_value]] = val
                end

              when /^(#{__methodcall_optkeys.keys.join('|')})$/
                method = _symbolkey2str(__methodcall_optkeys)[slot]
                return {slot => ['', '', '', self.__send__(method)]}

              when /^(#{__numval_optkeys.join('|')})$/
                # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)

                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]] )
                  begin
                    conf[__configinfo_struct[:default_value]] =
                      number(conf[__configinfo_struct[:default_value]])
                  rescue
                    conf[__configinfo_struct[:default_value]] = nil
                  end
                end
                if ( conf[__configinfo_struct[:current_value]] )
                  begin
                    conf[__configinfo_struct[:current_value]] =
                      number(conf[__configinfo_struct[:current_value]])
                  rescue
                    conf[__configinfo_struct[:current_value]] = nil
                  end
                end

              when /^(#{__numstrval_optkeys.join('|')})$/
                # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)

                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]] )
                  conf[__configinfo_struct[:default_value]] =
                    num_or_str(conf[__configinfo_struct[:default_value]])
                end
                if ( conf[__configinfo_struct[:current_value]] )
                  conf[__configinfo_struct[:current_value]] =
                    num_or_str(conf[__configinfo_struct[:current_value]])
                end

              when /^(#{__boolval_optkeys.join('|')})$/
                # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)

                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]] )
                  begin
                    conf[__configinfo_struct[:default_value]] =
                      bool(conf[__configinfo_struct[:default_value]])
                  rescue
                    conf[__configinfo_struct[:default_value]] = nil
                  end
                end
                if ( conf[__configinfo_struct[:current_value]] )
                  begin
                    conf[__configinfo_struct[:current_value]] =
                      bool(conf[__configinfo_struct[:current_value]])
                  rescue
                    conf[__configinfo_struct[:current_value]] = nil
                  end
                end

              when /^(#{__listval_optkeys.join('|')})$/
                # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)

                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]] )
                  conf[__configinfo_struct[:default_value]] =
                    simplelist(conf[__configinfo_struct[:default_value]])
                end
                if ( conf[__configinfo_struct[:current_value]] )
                  conf[__configinfo_struct[:current_value]] =
                    simplelist(conf[__configinfo_struct[:current_value]])
                end

              when /^(#{__numlistval_optkeys.join('|')})$/
                # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)

                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]] \
                    && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ )
                  conf[__configinfo_struct[:default_value]] =
                    list(conf[__configinfo_struct[:default_value]])
                end
                if ( conf[__configinfo_struct[:current_value]] \
                    && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ )
                  conf[__configinfo_struct[:current_value]] =
                    list(conf[__configinfo_struct[:current_value]])
                end

              when /^(#{__tkvariable_optkeys.join('|')})$/
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)

                if ( __configinfo_struct[:default_value] \
                    && conf[__configinfo_struct[:default_value]] )
                  v = conf[__configinfo_struct[:default_value]]
                  if v.empty?
                    conf[__configinfo_struct[:default_value]] = nil
                  else
                    conf[__configinfo_struct[:default_value]] = TkVarAccess.new(v)
                  end
                end
                if ( conf[__configinfo_struct[:current_value]] )
                  v = conf[__configinfo_struct[:current_value]]
                  if v.empty?
                    conf[__configinfo_struct[:current_value]] = nil
                  else
                    conf[__configinfo_struct[:current_value]] = TkVarAccess.new(v)
                  end
                end

              when /^(#{__strval_optkeys.join('|')})$/
                # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
              else
                # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
                conf = tk_split_list(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), 0, false, true)
              end
              conf[__configinfo_struct[:key]] =
                conf[__configinfo_struct[:key]][1..-1]

              if ( __configinfo_struct[:alias] \
                  && conf.size == __configinfo_struct[:alias] + 1 )
                if conf[__configinfo_struct[:alias]][0] == ?-
                  conf[__configinfo_struct[:alias]] =
                    conf[__configinfo_struct[:alias]][1..-1]
                end
                { conf[0] => conf[1] }
              else
                { conf.shift => conf }
              end

            else
              ret = {}
              # tk_split_simplelist(_fromUTF8(tk_call_without_enc(*__confinfo_cmd))).each{|conflist|
              #  conf = tk_split_simplelist(conflist)
              tk_split_simplelist(tk_call_without_enc(*__confinfo_cmd), false, false).each{|conflist|
                conf = tk_split_simplelist(conflist, false, true)
                conf[__configinfo_struct[:key]] =
                  conf[__configinfo_struct[:key]][1..-1]

                optkey = conf[__configinfo_struct[:key]]
                case optkey
                when /^(#{__val2ruby_optkeys().keys.join('|')})$/
                  method = _symbolkey2str(__val2ruby_optkeys())[optkey]
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    optval = conf[__configinfo_struct[:default_value]]
                    begin
                      val = method.call(optval)
                    rescue => e
                      warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
                      val = optval
                    end
                    conf[__configinfo_struct[:default_value]] = val
                  end
                  if ( conf[__configinfo_struct[:current_value]] )
                    optval = conf[__configinfo_struct[:current_value]]
                    begin
                      val = method.call(optval)
                    rescue => e
                      warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
                      val = optval
                    end
                    conf[__configinfo_struct[:current_value]] = val
                  end

                when /^(#{__strval_optkeys.join('|')})$/
                  # do nothing

                when /^(#{__numval_optkeys.join('|')})$/
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    begin
                      conf[__configinfo_struct[:default_value]] =
                        number(conf[__configinfo_struct[:default_value]])
                    rescue
                      conf[__configinfo_struct[:default_value]] = nil
                    end
                  end
                  if ( conf[__configinfo_struct[:current_value]] )
                    begin
                      conf[__configinfo_struct[:current_value]] =
                        number(conf[__configinfo_struct[:current_value]])
                    rescue
                      conf[__configinfo_struct[:current_value]] = nil
                    end
                  end

                when /^(#{__numstrval_optkeys.join('|')})$/
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    conf[__configinfo_struct[:default_value]] =
                      num_or_str(conf[__configinfo_struct[:default_value]])
                  end
                  if ( conf[__configinfo_struct[:current_value]] )
                    conf[__configinfo_struct[:current_value]] =
                      num_or_str(conf[__configinfo_struct[:current_value]])
                  end

                when /^(#{__boolval_optkeys.join('|')})$/
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    begin
                      conf[__configinfo_struct[:default_value]] =
                        bool(conf[__configinfo_struct[:default_value]])
                    rescue
                      conf[__configinfo_struct[:default_value]] = nil
                    end
                  end
                  if ( conf[__configinfo_struct[:current_value]] )
                    begin
                      conf[__configinfo_struct[:current_value]] =
                        bool(conf[__configinfo_struct[:current_value]])
                    rescue
                      conf[__configinfo_struct[:current_value]] = nil
                    end
                  end

                when /^(#{__listval_optkeys.join('|')})$/
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    conf[__configinfo_struct[:default_value]] =
                      simplelist(conf[__configinfo_struct[:default_value]])
                  end
                  if ( conf[__configinfo_struct[:current_value]] )
                    conf[__configinfo_struct[:current_value]] =
                      simplelist(conf[__configinfo_struct[:current_value]])
                  end

                when /^(#{__numlistval_optkeys.join('|')})$/
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] \
                      && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ )
                    conf[__configinfo_struct[:default_value]] =
                      list(conf[__configinfo_struct[:default_value]])
                  end
                  if ( conf[__configinfo_struct[:current_value]] \
                      && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ )
                    conf[__configinfo_struct[:current_value]] =
                      list(conf[__configinfo_struct[:current_value]])
                  end

                when /^(#{__tkvariable_optkeys.join('|')})$/
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    v = conf[__configinfo_struct[:default_value]]
                    if v.empty?
                      conf[__configinfo_struct[:default_value]] = nil
                    else
                      conf[__configinfo_struct[:default_value]] = TkVarAccess.new
                    end
                  end
                  if ( conf[__configinfo_struct[:current_value]] )
                    v = conf[__configinfo_struct[:current_value]]
                    if v.empty?
                      conf[__configinfo_struct[:current_value]] = nil
                    else
                      conf[__configinfo_struct[:current_value]] = TkVarAccess.new
                    end
                  end

                else
                  if ( __configinfo_struct[:default_value] \
                      && conf[__configinfo_struct[:default_value]] )
                    if conf[__configinfo_struct[:default_value]].index('{')
                      conf[__configinfo_struct[:default_value]] =
                        tk_split_list(conf[__configinfo_struct[:default_value]])
                    else
                      conf[__configinfo_struct[:default_value]] =
                        tk_tcl2ruby(conf[__configinfo_struct[:default_value]])
                    end
                  end
                  if conf[__configinfo_struct[:current_value]]
                    if conf[__configinfo_struct[:current_value]].index('{')
                      conf[__configinfo_struct[:current_value]] =
                        tk_split_list(conf[__configinfo_struct[:current_value]])
                    else
                      conf[__configinfo_struct[:current_value]] =
                        tk_tcl2ruby(conf[__configinfo_struct[:current_value]])
                    end
                  end
                end

                if ( __configinfo_struct[:alias] \
                    && conf.size == __configinfo_struct[:alias] + 1 )
                  if conf[__configinfo_struct[:alias]][0] == ?-
                    conf[__configinfo_struct[:alias]] =
                      conf[__configinfo_struct[:alias]][1..-1]
                  end
                  ret[conf[0]] = conf[1]
                else
                  ret[conf.shift] = conf
                end
              }

              __font_optkeys.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[__configinfo_struct[:current_value]] = fontobj(optkey)
                  ret[optkey] = fontconf
                end
              }

              __methodcall_optkeys.each{|optkey, method|
                ret[optkey.to_s] = ['', '', '', self.__send__(method)]
              }

              ret
            end
          end
        end
      end

configure(slot, value=None)

[Source]

    # File tk/lib/tk.rb, line 2871
      def configure(slot, value=None)
        if slot.kind_of? Hash
          slot = _symbolkey2str(slot)

          __methodcall_optkeys.each{|key, method|
            value = slot.delete(key.to_s)
            self.__send__(method, value) if value
          }

          __ruby2val_optkeys.each{|key, method|
            key = key.to_s
            slot[key] = method.call(slot[key]) if slot.has_key?(key)
          }

          __keyonly_optkeys.each{|defkey, undefkey|
            conf = slot.find{|kk, vv| kk == defkey.to_s}
            if conf
              k, v = conf
              if v
                slot[k] = None
              else
                slot[undefkey.to_s] = None if undefkey
                slot.delete(k)
              end
            end
          }

          if (slot.find{|k, v| k =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/})
            font_configure(slot)
          elsif slot.size > 0
            tk_call(*(__config_cmd.concat(hash_kv(slot))))
          end

        else
          orig_slot = slot
          slot = slot.to_s
          if slot.length == 0
            fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
          end

          if ( conf = __keyonly_optkeys.find{|k, v| k.to_s == slot} )
            defkey, undefkey = conf
            if value
              tk_call(*(__config_cmd << "-#{defkey}"))
            elsif undefkey
              tk_call(*(__config_cmd << "-#{undefkey}"))
            end
          elsif ( method = _symbolkey2str(__ruby2val_optkeys)[slot] )
            tk_call(*(__config_cmd << "-#{slot}" << method.call(value)))
          elsif ( method = _symbolkey2str(__methodcall_optkeys)[slot] )
            self.__send__(method, value)
          elsif (slot =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
            if value == None
              fontobj($2)
            else
              font_configure({slot=>value})
            end
          else
            tk_call(*(__config_cmd << "-#{slot}" << value))
          end
        end
        self
      end

configure_cmd(slot, value)

[Source]

    # File tk/lib/tk.rb, line 2935
      def configure_cmd(slot, value)
        configure(slot, install_cmd(value))
      end

current_configinfo(slot = nil)

[Source]

    # File tk/lib/tk.rb, line 3672
      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{|conf|
              if ( ! __configinfo_struct[:alias] \
                  || conf.size > __configinfo_struct[:alias] + 1 )
                ret[conf[0]] = conf[-1]
              end
            }
            ret
          end
        else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
          ret = {}
          configinfo(slot).each{|key, conf|
            ret[key] = conf[-1] if conf.kind_of?(Array)
          }
          ret
        end
      end

[Validate]