Integral formulation for the two-dimensional spatial structure of drift and trapped-electron modes